Repository navigation
Fix zero-length MSI signature blob handling - #531
Merged
Merged
Conversation
stream_read() allocates and copies DigitalSignature and MsiDigitalSignatureEx blobs even when their length is zero. In the MsiDigitalSignatureEx path the source pointer can then be NULL, and memcpy() with a NULL source is undefined behavior that UBSAN rejects. Skip the allocation and copy when the blob is empty.
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.
Pull Request Type
Related Issue
Issue number: N/A
Current Behavior
stream_read()allocates and copiesDigitalSignatureandMsiDigitalSignatureExblobs even when their length is zero. In theMsiDigitalSignatureExpath the source pointer can then beNULL, andmemcpy()with aNULLsource is undefined behavior that UBSAN rejects, aborting the attach/remove operation.New Behavior
An empty signature blob now skips allocation and copying; the data pointer is left
NULL.Scope of Changes
Only
stream_read()inmsi.c.Testing
Built with ASAN+UBSAN together with the separate little-endian shift fix from #530 (the same reproducers also hit that independent UBSAN issue). All 57 attach/remove crash inputs then complete without the null-
memcpyreport.Additional Notes
Pre-existing issue found by fuzzing. It is undefined behavior rather than a memory write; the validation above needs #530 for a sanitizer-clean run of these particular inputs.
License Declaration