cap fullStage2Length to avoid size overflow in reconstituteData#4012
Open
rootvector2 wants to merge 1 commit into
Open
cap fullStage2Length to avoid size overflow in reconstituteData#4012rootvector2 wants to merge 1 commit into
rootvector2 wants to merge 1 commit into
Conversation
srl295
approved these changes
Jun 10, 2026
Member
|
Author
|
Restored and filled out the template in the description. I don't have a Jira account to file the ticket. Can you open one for this overflow, or point me at an umbrella issue to reuse? I'll prefix the title and commit with the number once it exists. On scope: this isn't comprehensive input validation, just the single |
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.
Description
reconstituteData()in the MBCS converter loader computesdataLength = stage1Length*2 + fullStage2Length*4 + fromUBytesLengthinuint32_t.A table with a large
fullStage2Lengthwraps this sum to a small value, souprv_mallocallocates an undersized buffer that the following
uprv_memcpyand stage-2 pointerarithmetic overrun.
This adds a 64-bit overflow check that rejects the table with
U_INVALID_TABLE_FORMAT,mirroring the other malformed-table guards already in the loader (
ucnv_MBCSLoad).Found while fuzzing the converter loader with mutated
.cnvtable data.Checklist