Skip to content

fix: Decode accepts the largest size limit - #5

Merged
Julian Köhn (juliankoehn) merged 1 commit into
mainfrom
fix/max-size-overflow
Oct 15, 2026
Merged

Julian Köhn (juliankoehn) merged 1 commit into
mainfrom
fix/max-size-overflow

Conversation

@juliankoehn

Copy link
Copy Markdown
Contributor

WithMaxSize(math.MaxInt64) made the size check in limitReader compute n+1, which overflowed to a negative bound and panicked on the first read. The check now compares against n and only slices to n+1 when that is smaller than the buffer.

The test in TestDecodeRejects decodes the minimal document with the largest limit; it panicked before the fix.

https://claude.ai/code/session_0168DfDKifRapP2xPKwZ8anF

WithMaxSize(math.MaxInt64) made the size check compute n+1, which
overflowed to a negative bound and panicked on the first read. The check
now compares against n and only slices to n+1 when that is smaller than
the buffer.

Claude-Session: https://claude.ai/code/session_0168DfDKifRapP2xPKwZ8anF
@juliankoehn
Julian Köhn (juliankoehn) merged commit 4d3cd87 into main Oct 15, 2026
16 checks passed
@juliankoehn
Julian Köhn (juliankoehn) deleted the fix/max-size-overflow branch October 15, 2026 14:01
Julian Köhn (juliankoehn) pushed a commit that referenced this pull request Oct 15, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.1.1](esdscom-v0.1.0...esdscom-v0.1.1)
(2026-10-15)


### Bug Fixes

* Decode accepts the largest size limit
([#5](#5))
([4d3cd87](4d3cd87))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: velcure-release[bot] <342924300+velcure-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant