Repository navigation
[#1780] Guard NULL pointers, overflow, and freed outputs in ZSTD string helpers - #1781
Open
hardikkaurani wants to merge 1 commit into
Open
hardikkaurani wants to merge 1 commit into
hardikkaurani wants to merge 1 commit into
Conversation
Contributor
Author
|
@jesperpedersen @Pranav-error Hi, this PR addresses #1780 in
Formatting passes |
ecleon26
self-requested a review
December 1, 2026 14:58
ecleon26
requested changes
Dec 1, 2026
| size_t decompressed_size; | ||
| size_t result; | ||
|
|
||
| if (compressed_buffer == NULL || output_string == NULL) |
Contributor
Author
There was a problem hiding this comment.
Removed the SIZE_MAX check in d1bb259.
Collaborator
|
@hardikkaurani good catch Remove the SIZE_MAX check, the two sentinel values are already handled pgmoneta_bzip2_string() has the same problem. Do all the compression string functions in one PR together with #1779 |
hardikkaurani
force-pushed
the
fix/zstd-string-null-and-dangling-ptr
branch
from
December 1, 2026 15:15
973e29a to
d1bb259
Compare
…LZ4, and BZIP2 string helpers Signed-off-by: Hardik Kaurani <[email protected]>
Contributor
Author
|
@ecleon26 Updated in
|
Collaborator
|
@hardikkaurani Please Rebase |
Contributor
Author
|
@ecleon26 Rebased onto main! |
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.
Closes #1780
Summary
s,buffer, andbuffer_sizeforNULLinpgmoneta_zstdc_string()(src/libpgmoneta/zstandard_compression.c), initialize*buffer = NULLand*buffer_size = 0, and reset*buffer = NULLafterfree(*buffer)on error.compressed_bufferandoutput_stringforNULLinpgmoneta_zstdd_string(), initialize*output_string = NULL, guarddecompressed_size > SIZE_MAX - 1, and reset*output_string = NULLafterfree(*output_string)on decompression failure.MCTF_TEST_NEGATIVE(test_zstd_string_null_and_invalid)intest/testcases/test_compression.c.Verification
clang-format --dry-run --Werror.