shadow1ng/fscan · error

invalid oracle integer size %d

Error message

invalid oracle integer size %d

What it means

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.

Source

Thrown at plugins/services/oracle_raw.go:531

func (s *oracleSession) getInt64(size int, compress, bigEndian bool) (int64, error) {
	neg := false
	if compress {
		b, err := s.read(1)
		if err != nil {
			return 0, err
		}
		size = int(b[0])
		if size&0x80 != 0 {
			neg = true
			size &= 0x7f
		}
		bigEndian = true
	}
	if size == 0 {
		return 0, nil
	}
	if size > 8 {
		return 0, fmt.Errorf("invalid oracle integer size %d", size)
	}
	b, err := s.read(size)
	if err != nil {
		return 0, err
	}
	tmp := make([]byte, 8)
	if bigEndian {
		copy(tmp[8-size:], b)
		v := int64(binary.BigEndian.Uint64(tmp))
		if neg {
			v = -v
		}
		return v, nil
	}
	copy(tmp[:size], b)
	v := int64(binary.LittleEndian.Uint64(tmp))
	if neg {
		v = -v

View on GitHub (pinned to 95cc12e753)

Solutions

  1. Re-sync the session: reconnect rather than continuing after this error, since the offset is now unreliable
  2. Verify the packet/ANO header offsets are correct before the integer read
  3. Check that the negotiated data format (compress flags) matches what the client parses
  4. Log the size byte and surrounding bytes to diagnose framing drift

Example fix

// before
if size > 8 {
    return 0, fmt.Errorf("invalid oracle integer size %d", size)
}
// after
if size > 8 {
    return 0, fmt.Errorf("invalid oracle integer size %d at offset %d", size, s.index)
}
Defensive patterns

Strategy: validation

Validate before calling

func validOracleIntSize(size byte) bool { return size <= 8 }

Try / catch

v, err := s.getInt64()
if err != nil {
    if strings.Contains(err.Error(), "invalid oracle integer size") {
        return resyncSession() // offset unreliable; reconnect rather than continue
    }
    return err
}

Prevention

When it happens

Trigger: getInt (via getInt64), readANOHeader, or tests TestSessionGetInt64Compress/Negative/Zero read a size byte > 8 from the session stream.

Common situations: 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.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


AI-assisted analysis of shadow1ng/fscan@95cc12e753 (2026-09-06). Data as JSON: /api/errors/bd6db85928176611. Report an issue: GitHub.