Commit 0f2e583
Validate the full 8-byte end marker in zero-column RowsResponse decoding
The decoder's fast path for column_count == 0 checked only the first
byte of the end-of-rows sentinel (0xff for DONE, 0xee for PART) and
accepted any 7 trailing bytes. The non-zero-column path goes through
decode_row_header, which validates the full 8-byte DQLITE_RESPONSE_ROWS_DONE
/ _PART word, so a torn or corrupt marker like 0xff 0x00..0x00 was
silently accepted on the zero-column path while being rejected on the
normal path. A legitimate peer always emits the full sentinel; treating
a torn shape as valid desynchronises the stream and risks returning a
wrong has_more value on zero-column results.
Use the same full-word compare against _ROW_DONE_MARKER /
_ROW_PART_MARKER on both paths and drop the now-unused ROW_DONE_BYTE /
ROW_PART_BYTE imports. Regression tests cover both torn DONE and torn
PART shapes.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent ee92105 commit 0f2e583
2 files changed
Lines changed: 29 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
| |||
15 | 13 | | |
16 | 14 | | |
17 | 15 | | |
| 16 | + | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
372 | 376 | | |
373 | 377 | | |
374 | 378 | | |
375 | 379 | | |
376 | 380 | | |
377 | | - | |
378 | | - | |
| 381 | + | |
| 382 | + | |
379 | 383 | | |
380 | | - | |
| 384 | + | |
381 | 385 | | |
382 | 386 | | |
383 | 387 | | |
384 | | - | |
| 388 | + | |
385 | 389 | | |
386 | 390 | | |
387 | 391 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
503 | 503 | | |
504 | 504 | | |
505 | 505 | | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
506 | 525 | | |
507 | 526 | | |
508 | 527 | | |
| |||
0 commit comments