jaideeppyne opened a new pull request, #205:
URL: https://github.com/apache/datasketches-go/pull/205

   ## Problem
   
   The string SerDe allocates its result and payload buffers before validating 
serialized counts and lengths. On 32-bit builds, converting an unsigned length 
prefix to `int` can also wrap negative, so `SizeOfMany` can accept an invalid 
length while deserialization panics.
   
   ## Change
   
   - Bound the item count by the available length-prefix bytes before 
allocating the result.
   - Compare unsigned payload lengths with the remaining bytes before 
converting to `int` or copying.
   - Keep the existing error contract, wire format, empty-count behavior, and 
ownership of decoded strings.
   
   Regression tests cover invalid offsets, truncated prefixes/payloads, 
impossible counts, the signed and unsigned 32-bit length boundaries, and 
Unicode/empty-string round trips with offsets. A fuzz property checks agreement 
between size calculation and decoding.
   
   ## Verification
   
   [Tests-first and full 
verification](https://github.com/jaideeppyne/datasketches-go/actions/runs/40831666228)
 passed on Go 1.24 and 1.26:
   
   - The new tests reproduce panics and incorrect size results against 
unchanged production on `GOARCH=386`.
   - Full build and `go test -race -count=1 ./...` passed after downloading 
foreign snapshots and generating the required Go snapshots.
   - `go vet ./...`, the full 32-bit common tests, a 10-second fuzz run, and 
golangci-lint 2.13.2 passed on each Go version.
   - Formatting and tracked-source checks passed.
   
   Source: `ba4fc715ec15df05e6334fee4b120589b68dd7db`. No dependencies or 
serialized bytes changed.
   
   Prepared with OpenAI Codex assistance, including implementation and tests.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to