Repository navigation
Make uint32_t to zend_long conversion explicit in unpack() - #24258
Open
ushevchenko wants to merge 1 commit into
Open
ushevchenko wants to merge 1 commit into
ushevchenko wants to merge 1 commit into
Conversation
Problem: In unpack(), a uint32_t value is implicitly converted to zend_long for the L, N and V formats. On 32-bit builds values above INT32_MAX may become negative; the conversion is implementation-defined. Solution: add an explicit (zend_long) cast. The returned values do not change on any platform. Signed-off-by: Uliya Shevchenko <u.shevchenko@fobos-nt.ru> Signed-off-by: Georgij Tsarin <crystarm@altlinux.org>
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.
Fixes #24257
unpack()converts auint32_ttozend_longimplicitly for theL,NandVformats. On 32-bit builds this conversion is implementation-defined for values aboveINT32_MAX. The signed variant (l) in the same block already uses an explicit cast.This change makes the conversion explicit. The returned values do not change on any platform, so no test was added.
The issue was identified by static analysis (Svace) and has not been reproduced at runtime on a 32-bit build.
Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.