sql(mysql): bounds-check params in bind() when values array is mutated - #29886
Merged
Claude / Claude Code Review
completed
Apr 28, 2026 in 42m 33s
Code review found 1 important issue
Found 2 candidates, confirmed 1. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 1 |
| 🟡 Nit | 0 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🔴 Important | src/sql/mysql/MySQLQuery.zig:27-33 |
bind() error leaves stale 4-byte packet header in connection write_buffer |
Annotations
Check failure on line 33 in src/sql/mysql/MySQLQuery.zig
claude / Claude Code Review
bind() error leaves stale 4-byte packet header in connection write_buffer
When `bind()` returns the new `error.WrongNumberOfParametersProvided`, the 4-byte zero placeholder header that `writer.start(0)` already appended to `connection.#write_buffer` is never rolled back — the next query on this pooled connection will be prefixed with a bogus `[0,0,0,0]` packet and the wire protocol desyncs. The missing rollback is pre-existing (it already affects `Value.fromJS`/`iter.next()` failures), but this PR adds two new error returns that flow through it and the fix is trivial
Loading