mem_alloc_test fixes#31158
Closed
esyr wants to merge 2 commits into
Closed
Conversation
937ba43 to
0c6adee
Compare
npajkovsky
reviewed
May 12, 2026
| SIZE_MAX - SQRT_SIZE_T + SQSQRT_SIZE_T, | ||
| SIZE_MAX - SQRT_SIZE_T + SQSQRT_SIZE_T, | ||
| EXP_OOM, EXP_INT_OF | ||
| }, |
There was a problem hiding this comment.
I would not try to figure out the formula that tries to overflow size_t to the point where it expects oom, and rather simply remove it.
Member
There was a problem hiding this comment.
Yeah, this is IMO too fragile and not sure why do we need such test case.
…failure While half of the address space is enough to make malloc() fail on kernels of the same bitness, 32-bit compat can have enough to accommodate such a request, and even three fourth of the address space. Bump the requested size closer to the type's upper limit. Fixes: d090695 "test: add a sanity test for memory allocation functions" Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
That puts them more in line with CRYPTO_malloc() and CRYPTO_realloc() behaviour, whose behaviour for the requested size of 0 is well-documented and not "implementation-defined", as POSIX allows. Fixes: d090695 "test: add a sanity test for memory allocation functions" Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
0c6adee to
d1af253
Compare
npajkovsky
approved these changes
May 13, 2026
t8m
approved these changes
May 13, 2026
Collaborator
|
This pull request is ready to merge |
openssl-machine
pushed a commit
that referenced
this pull request
May 18, 2026
…failure While half of the address space is enough to make malloc() fail on kernels of the same bitness, 32-bit compat can have enough to accommodate such a request, and even three fourth of the address space. Bump the requested size closer to the type's upper limit. Fixes: d090695 "test: add a sanity test for memory allocation functions" Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.foundation> Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org> MergeDate: Mon May 18 07:31:04 2026 (Merged from #31158)
openssl-machine
pushed a commit
that referenced
this pull request
May 18, 2026
That puts them more in line with CRYPTO_malloc() and CRYPTO_realloc() behaviour, whose behaviour for the requested size of 0 is well-documented and not "implementation-defined", as POSIX allows. Fixes: d090695 "test: add a sanity test for memory allocation functions" Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.foundation> Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org> MergeDate: Mon May 18 07:31:04 2026 (Merged from #31158)
openssl-machine
pushed a commit
that referenced
this pull request
May 18, 2026
…failure While half of the address space is enough to make malloc() fail on kernels of the same bitness, 32-bit compat can have enough to accommodate such a request, and even three fourth of the address space. Bump the requested size closer to the type's upper limit. Fixes: d090695 "test: add a sanity test for memory allocation functions" Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.foundation> Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org> MergeDate: Mon May 18 07:30:48 2026 (Merged from #31158)
openssl-machine
pushed a commit
that referenced
this pull request
May 18, 2026
That puts them more in line with CRYPTO_malloc() and CRYPTO_realloc() behaviour, whose behaviour for the requested size of 0 is well-documented and not "implementation-defined", as POSIX allows. Fixes: d090695 "test: add a sanity test for memory allocation functions" Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.foundation> Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org> MergeDate: Mon May 18 07:30:49 2026 (Merged from #31158)
Contributor
|
Merged to the labeled branches. Thank you! |
openssl-machine
pushed a commit
that referenced
this pull request
May 18, 2026
…failure While half of the address space is enough to make malloc() fail on kernels of the same bitness, 32-bit compat can have enough to accommodate such a request, and even three fourth of the address space. Bump the requested size closer to the type's upper limit. Fixes: d090695 "test: add a sanity test for memory allocation functions" Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.foundation> Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org> MergeDate: Mon May 18 07:31:16 2026 (Merged from #31158)
openssl-machine
pushed a commit
that referenced
this pull request
May 18, 2026
That puts them more in line with CRYPTO_malloc() and CRYPTO_realloc() behaviour, whose behaviour for the requested size of 0 is well-documented and not "implementation-defined", as POSIX allows. Fixes: d090695 "test: add a sanity test for memory allocation functions" Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.foundation> Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org> MergeDate: Mon May 18 07:31:17 2026 (Merged from #31158)
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.
This patch set addresses the following issues:
my_mallocandmy_reallocis updated to match behaviour ofCRYPTO_mallocandCRYPTO_reallocmore closely.