Commit 8aea406
Reject zero-column RowsResponse rows at encode time
encode_body() silently accepted a RowsResponse with empty
column_names and a non-empty rows list. Each row contributed zero
bytes to the encoded payload, so the resulting message was
indistinguishable from a zero-row result set — round-tripping lost
the rows. decode_body() already has a zero-column fast path that
returns no rows.
Raise EncodeError when col_count == 0 and rows is non-empty. Place
the check above the per-row length validation so the higher-level
diagnostic wins over the "row N has 0 values, expected 0" message
that would otherwise fire (and confuse).
Zero-column-zero-row remains valid (symmetric with the decoder).
SQLite cannot produce zero-column results from sqlite3_step, so the
C server never hits this case; the fix is purely symmetry hardening
for mock-server authors and fuzzers.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5647b89 commit 8aea406
2 files changed
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
303 | 312 | | |
304 | 313 | | |
305 | 314 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
686 | 686 | | |
687 | 687 | | |
688 | 688 | | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
689 | 704 | | |
690 | 705 | | |
691 | 706 | | |
| |||
0 commit comments