Repository navigation
rtpmjpeg: reject reserved quantization value 127 - #1161
Merged
Merged
Conversation
RFC 2435 reserves quantization values 100-127, but the guard used `Quantization < 127`, letting 127 through. It then reached makeQuantizationTables(127), where scale = 200 - 2*127 = -54, producing a corrupt quantization table instead of a clean rejection.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1161 +/- ##
==========================================
- Coverage 87.23% 87.20% -0.03%
==========================================
Files 133 133
Lines 10623 10623
==========================================
- Hits 9267 9264 -3
- Misses 1356 1359 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
CI note: the |
Member
|
merged, thanks |
Contributor
Author
|
Thanks @aler9! |
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.
RFC 2435 reserves quantization values 100-127. The header guard used
Quantization > 99 && Quantization < 127, so it rejected 100-126 but let 127 through.A leaked 127 then reaches
makeQuantizationTables(127)(Quantization < 128takes the fixed-table path), wherescale = 200 - 2*127 = -54. The negative scale produces a corrupt quantization table (e.g.tables[0][0] = 248) instead of the clean rejection every other reserved value gets — a silently corrupt JPEG for a non-conforming sender.Fix: widen the guard to
< 128so all of 100-127 are rejected. AddedTestHeaderJpegUnmarshalErrorscovering 0, 100, 126 and 127 (fails on 127 before the change).