sqlmapproject/sqlmap · error · InterfaceError
malformed ROWFMT token
Error message
malformed ROWFMT token (%d columns did not fill %d bytes)
What it means
After walking all declared columns in a TDS ROWFMT token the offset does not consume exactly the token's declared length: the column-format parser and the server disagree on field layout (version skew or corrupt token), so the guard refuses the response.
Solutions
- Compare the TDS 5 column-format spec against the parser's offsets for this server version
- Drop the connection; row decoding from a misparsed ROWFMT would yield garbage
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at extra/dbwire/sybase.py:180 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of sqlmapproject/sqlmap@0a35b20e39 (2026-08-26).
Data as JSON: /api/errors/39aae6369afbe7b1.
Report an issue: GitHub.
Appendix: source
Thrown at extra/dbwire/sybase.py:180
off += 1 # status (nullability - the value length says it)
col.usertype = _i32(data, off); off += 4
col.type = _u8(data, off); off += 1
col.size, col.scale = _FIXED_LENGTH.get(col.type, 0), 0
if col.type in _DECIMAL_TYPES:
col.size = _u8(data, off)
col.scale = _u8(data, off + 2) # precision (off + 1) is not needed to decode
off += 3
elif col.type in _BLOB_TYPES:
col.size = _i32(data, off); off += 4
off += 2 + _u16(data, off) # the blob's table name
elif col.type in _LONG_TYPES:
col.size = _i32(data, off); off += 4
elif col.type not in _FIXED_LENGTH:
col.size = _u8(data, off); off += 1
off += 1 + _u8(data, off) # locale
columns.append(col)
if off != end:
raise InterfaceError("malformed ROWFMT token (%d columns did not fill %d bytes)" % (count, length))
return columns, off
def _decode_numeric(raw, scale):
# sign byte then a BIG-endian magnitude, and 1 means NEGATIVE (the Microsoft encoding is the mirror
# image of this: little-endian, 1 == positive)
magnitude = 0
for b in bytearray(raw[1:]):
magnitude = (magnitude << 8) | b
value = -magnitude if bytearray(raw)[0] else magnitude
if scale:
text = "%0*d" % (scale + 1, abs(value))
return ("-" if value < 0 else "") + text[:-scale] + "." + text[-scale:]
return "%d" % value
def _decode_date(raw):
import datetime
return "%s" % (datetime.date(1900, 1, 1) + datetime.timedelta(days=_i32(raw, 0)))
View on GitHub (pinned to 0a35b20e39)