Fix uint16 overflow in _zip_ef_size() extra field accumulator#522
Open
kodareef5 wants to merge 1 commit intonih-at:mainfrom
Open
Fix uint16 overflow in _zip_ef_size() extra field accumulator#522kodareef5 wants to merge 1 commit intonih-at:mainfrom
kodareef5 wants to merge 1 commit intonih-at:mainfrom
Conversation
_zip_ef_size() accumulates extra field sizes into a zip_uint16_t. When the total exceeds 65535, the value wraps around silently. The developer acknowledged this at zip_dirent.c:1075 with a "TODO: check for overflow" comment. Fix by accumulating into zip_uint32_t and capping the return value at ZIP_UINT16_MAX.
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.
_zip_ef_size()atlib/zip_extra_field.c:309accumulates extra field sizes into azip_uint16_t. When the total exceeds 65535, the value wraps around silently. This is noted by theTODO: check for overflowcomment atzip_dirent.c:1075.Fix: accumulate into
zip_uint32_tand cap the return value atZIP_UINT16_MAX.