Fix deadly-signal crash in CSV segmenter (#718)#718
Closed
daniellerozenblit wants to merge 1 commit into
Closed
Conversation
|
@daniellerozenblit has exported this pull request. If you are a Meta employee, you can view the originating Diff in D103001388. |
f229677 to
96d94a8
Compare
daniellerozenblit
added a commit
to daniellerozenblit/openzl-1
that referenced
this pull request
May 5, 2026
Summary:
The CSV segmenter crashed (fatal assertion) when processing input with high token density (e.g., many consecutive separators). The root cause was twofold:
1. `maxNumTokens` was calculated as `min(byteSize, chunkByteSizeMax)`, assuming at most 1 token per byte. But consecutive separators produce 2 tokens per byte (empty field + separator), causing the lexer to exhaust the token buffer before consuming enough bytes.
2. When the token buffer was exhausted mid-chunk, the segmenter's internal consistency checks fired with `logicError`, which triggers a fatal assertion in `ZL_E_create_va` ("Logic errors should never actually be generated").
Fix:
- Increase `maxNumTokens` to `2 * chunkSize + 1` to handle worst-case token density
- Change `logicError` to `node_invalid_input` for defense-in-depth, so any remaining edge cases produce a clean error instead of a crash
Reviewed By: Victor-C-Zhang
Differential Revision: D103001388
daniellerozenblit
added a commit
to daniellerozenblit/openzl-1
that referenced
this pull request
May 5, 2026
Summary:
The CSV segmenter crashed (fatal assertion) when processing input with high token density (e.g., many consecutive separators). The root cause was twofold:
1. `maxNumTokens` was calculated as `min(byteSize, chunkByteSizeMax)`, assuming at most 1 token per byte. But consecutive separators produce 2 tokens per byte (empty field + separator), causing the lexer to exhaust the token buffer before consuming enough bytes.
2. When the token buffer was exhausted mid-chunk, the segmenter's internal consistency checks fired with `logicError`, which triggers a fatal assertion in `ZL_E_create_va` ("Logic errors should never actually be generated").
Fix:
- Increase `maxNumTokens` to `2 * chunkSize + 1` to handle worst-case token density
- Change `logicError` to `node_invalid_input` for defense-in-depth, so any remaining edge cases produce a clean error instead of a crash
Reviewed By: Victor-C-Zhang
Differential Revision: D103001388
96d94a8 to
8b4adb5
Compare
daniellerozenblit
added a commit
to daniellerozenblit/openzl-1
that referenced
this pull request
May 5, 2026
Summary:
The CSV segmenter crashed (fatal assertion) when processing input with high token density (e.g., many consecutive separators). The root cause was twofold:
1. `maxNumTokens` was calculated as `min(byteSize, chunkByteSizeMax)`, assuming at most 1 token per byte. But consecutive separators produce 2 tokens per byte (empty field + separator), causing the lexer to exhaust the token buffer before consuming enough bytes.
2. When the token buffer was exhausted mid-chunk, the segmenter's internal consistency checks fired with `logicError`, which triggers a fatal assertion in `ZL_E_create_va` ("Logic errors should never actually be generated").
Fix:
- Increase `maxNumTokens` to `2 * chunkSize + 1` to handle worst-case token density
Reviewed By: Victor-C-Zhang
Differential Revision: D103001388
8b4adb5 to
d798ad0
Compare
Summary:
The CSV segmenter crashed (fatal assertion) when processing input with high token density (e.g., many consecutive separators). The root cause was twofold:
1. `maxNumTokens` was calculated as `min(byteSize, chunkByteSizeMax)`, assuming at most 1 token per byte. But consecutive separators produce 2 tokens per byte (empty field + separator), causing the lexer to exhaust the token buffer before consuming enough bytes.
2. When the token buffer was exhausted mid-chunk, the segmenter's internal consistency checks fired with `logicError`, which triggers a fatal assertion in `ZL_E_create_va` ("Logic errors should never actually be generated").
Fix:
- Increase `maxNumTokens` to `2 * chunkSize + 1` to handle worst-case token density
Reviewed By: Victor-C-Zhang
Differential Revision: D103001388
d798ad0 to
eef6bbe
Compare
|
This pull request has been merged in 6959466. |
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.
Summary:
The CSV segmenter crashed (fatal assertion) when processing input with high token density (e.g., many consecutive separators). The root cause was twofold:
maxNumTokenswas calculated asmin(byteSize, chunkByteSizeMax), assuming at most 1 token per byte. But consecutive separators produce 2 tokens per byte (empty field + separator), causing the lexer to exhaust the token buffer before consuming enough bytes.When the token buffer was exhausted mid-chunk, the segmenter's internal consistency checks fired with
logicError, which triggers a fatal assertion inZL_E_create_va("Logic errors should never actually be generated").Fix:
maxNumTokensto2 * chunkSize + 1to handle worst-case token densityReviewed By: Victor-C-Zhang
Differential Revision: D103001388