Repository navigation
tokenizer: a token id past the cap is refused at load - #3033
Merged
Merged
Conversation
ashhart
marked this pull request as ready for review
November 12, 2026 17:36
Owner
Author
|
Review: ready. The cap is checked at both load paths (
|
This was referenced Nov 12, 2026
An id near 2^32 in tokenizer.json sized a table of tens of gigabytes. Ids are capped when the file loads.
ashhart
force-pushed
the
security/tokenizer-id-cap
branch
from
November 13, 2026 00:05
77328b2 to
5897258
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Before: a token id near 2^32 in
tokenizer.jsonsized a table of tens of gigabytes. After: an id above 16,777,215 is refused when the file loads.SECURITY.mdasks for private reports, so there is no public issue.atc overlap --json: not run.Checks on this head
77328b238bb6f644c9257116d4c1a9c621d553adpython3 tools/zig/lean_check.py, on the base and on this head: 345 on the base, 345 on this head, 0 new.zig fmt --checkon 3 files: passesgit diff --check: passeszig test --dep sys -Mroot=zig/src/core/tokenizer/tokenizer.zig -Msys=zig/src/platform/sys.zig -lc(the tokenizer module has no host step of its own): All 55 tests passed.zig build test-server-cpu: 5/5 steps succeeded; 1325/1332 tests passed (7 skipped)zig build test-golden test-server-security test-pull-security: 76/76 steps succeeded; 32/32 tests passedsecurity: a tokenizer file cannot name a token id that sizes a huge tablezig build testand every step that runs on a GPU were not run: this Mac's GPU was serving a model, and no CUDA, ROCm or Intel hardware was available.Receipt
n/a. This change cannot reach inference: it is a load-time check of the tokenizer file. A tokenizer that loads today has no such id.
Checklist
zig testcommand: exit 1. 54 passed, 1 failed: the new test.Notes for the reviewer
id + 1overflow. This adds the cap.Suggested changelog line
Tokenizer: a token id past the cap is refused at load.