Skip to content

postgres: validate binary datum length and range before decoding - #33576

Open
robobun wants to merge 7 commits into
mainfrom
farm/739b9cc3/pg-binary-datum-validation
Open

postgres: validate binary datum length and range before decoding#33576
robobun wants to merge 7 commits into
mainfrom
farm/739b9cc3/pg-binary-datum-validation

[autofix.ci] apply automated fixes

3553dd1
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 7, 2026 in 11m 34s

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/postgres/types/Tag.rs:212-217 is_binary_format_textlike() omits json and xml, so BINARY CURSOR over those columns still regresses

Annotations

Check failure on line 217 in src/sql/postgres/types/Tag.rs

See this annotation in the file changed.

@claude claude / Claude Code Review

is_binary_format_textlike() omits json and xml, so BINARY CURSOR over those columns still regresses

The exemption list here omits `json` (oid 114) and `xml` (oid 142), whose `json_send()`/`xml_send()` also emit raw string bytes byte-identical to text output — so a simple-protocol `FETCH` from a `BINARY CURSOR` over a json or xml column now throws `ERR_POSTGRES_UNKNOWN_FORMAT_CODE` where it previously decoded correctly. Add `| Tag::json | Tag::xml` to the `matches!` arm (but not `jsonb`, whose `jsonb_send()` prepends a version byte).