{"record":{"id":"bd6db85928176611","repo":"shadow1ng/fscan","slug":"invalid-oracle-integer-size-d","errorCode":null,"errorMessage":"invalid oracle integer size %d","messagePattern":"invalid oracle integer size (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/services/oracle_raw.go","lineNumber":531,"sourceCode":"func (s *oracleSession) getInt64(size int, compress, bigEndian bool) (int64, error) {\n\tneg := false\n\tif compress {\n\t\tb, err := s.read(1)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tsize = int(b[0])\n\t\tif size&0x80 != 0 {\n\t\t\tneg = true\n\t\t\tsize &= 0x7f\n\t\t}\n\t\tbigEndian = true\n\t}\n\tif size == 0 {\n\t\treturn 0, nil\n\t}\n\tif size > 8 {\n\t\treturn 0, fmt.Errorf(\"invalid oracle integer size %d\", size)\n\t}\n\tb, err := s.read(size)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\ttmp := make([]byte, 8)\n\tif bigEndian {\n\t\tcopy(tmp[8-size:], b)\n\t\tv := int64(binary.BigEndian.Uint64(tmp))\n\t\tif neg {\n\t\t\tv = -v\n\t\t}\n\t\treturn v, nil\n\t}\n\tcopy(tmp[:size], b)\n\tv := int64(binary.LittleEndian.Uint64(tmp))\n\tif neg {\n\t\tv = -v","sourceCodeStart":513,"sourceCodeEnd":549,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/services/oracle_raw.go#L513-L549","documentation":"getInt64 decodes Oracle's compressed integer wire format, where the first byte gives the byte-width of the encoded value. This error is thrown when the declared width exceeds 8, since a 64-bit integer cannot occupy more than 8 bytes — meaning the stream is corrupted or not an Oracle integer at the current offset.","triggerScenarios":"getInt (via getInt64), readANOHeader, or tests TestSessionGetInt64Compress/Negative/Zero read a size byte > 8 from the session stream.","commonSituations":"Stream desynchronization after an earlier malformed packet; ANO header parsed at the wrong offset; corrupted TCP payload; server sends a non-compressed integer where the client expects compressed format.","solutions":["Re-sync the session: reconnect rather than continuing after this error, since the offset is now unreliable","Verify the packet/ANO header offsets are correct before the integer read","Check that the negotiated data format (compress flags) matches what the client parses","Log the size byte and surrounding bytes to diagnose framing drift"],"exampleFix":"// before\nif size > 8 {\n    return 0, fmt.Errorf(\"invalid oracle integer size %d\", size)\n}\n// after\nif size > 8 {\n    return 0, fmt.Errorf(\"invalid oracle integer size %d at offset %d\", size, s.index)\n}","handlingStrategy":"validation","validationCode":"func validOracleIntSize(size byte) bool { return size <= 8 }","typeGuard":null,"tryCatchPattern":"v, err := s.getInt64()\nif err != nil {\n    if strings.Contains(err.Error(), \"invalid oracle integer size\") {\n        return resyncSession() // offset unreliable; reconnect rather than continue\n    }\n    return err\n}","preventionTips":["Verify ANO/header offsets before decoding compressed integers","Confirm negotiated compress flags match the parser's expectations","Never keep reading after a size error — the stream offset is already wrong"],"tags":["oracle","tns","protocol-violation","integer-decoding"],"backgroundTag":"value-out-of-range","analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}