Repository navigation
fix(libressl): free lookup on insertion exceptions - #19820
Merged
oneandonlydean merged 1 commit intoNov 14, 2026
Merged
oneandonlydean merged 1 commit into
oneandonlydean merged 1 commit into
Conversation
Contributor
|
Windows check of head Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release. The hosted Windows check does not run these tests on pull requests.
AI-assisted: yes. |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
PrivacyOnion
approved these changes
Nov 14, 2026
PrivacyOnion
left a comment
Contributor
There was a problem hiding this comment.
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 91b8fe5e00:
- Conventions:
tools/check_conventions.pypassed;git diff --checkclean. - Build:
guest_libressl_x509_lookup_testsbuilt cleanly. - CTest (
guest_libressl_x509_lookup,guest_libressl_x509_lookup_allocator):1/2 Test #3772: guest_libressl_x509_lookup ............. Passed 0.01 sec 2/2 Test #3773: guest_libressl_x509_lookup_allocator ... Passed 0.00 sec 100% tests passed, 0 tests failed out of 2 - Negative control: with
core/libs/prx/libSceLibreSsl/src/X509Store.cppreverted tomainand the new tests kept, the suite fails:Restoring the change makes it pass again.1/2 Test #3772: guest_libressl_x509_lookup ............. Passed 0.01 sec 2/2 Test #3773: guest_libressl_x509_lookup_allocator ...Subprocess aborted***Exception: 0.12 sec 50% tests passed, 1 tests failed out of 2 - Code reading:
- core/libs/prx/libSceLibreSsl/src/X509Store.cpp:246: Verified that X509_STORE_add_lookup_nid_postfix wraps Push in a try/catch block that invokes FreeLookup(lookup, false, func) and rethrows on insertion exceptions, correctly freeing the accepted lookup without invoking shutdown.
- core/libs/prx/libSceLibreSsl/src/X509Store.cpp:243-255: Verified that lookup->storeContext initialization ordering, non-throwing Push failure handling, and method deduplication paths remain intact and leak-free.
- core/libs/prx/libSceLibreSsl/tests/X509Lookup.cpp:205-232: Verified that MalformedStackCleanup tests both malformed stack conditions (numAlloc == 0 and num == -1), ensuring allocation and free counts balance (1 alloc, 1 free), callbacks run in expected order without shutdown, stack state is preserved, and seeded error queues remain undisturbed.
- core/libs/prx/libSceLibreSsl/tests/X509Lookup.cpp:234-255: Verified that ThrowingFreeOnFailedPush confirms exception preservation when method->free throws upon failed push without corrupting the store stack.
- docs/dev/debt/libSceLibreSsl.md:171: Verified that the technical debt document accurately trims only the resolved leaked-lookup clause while retaining existing documentation of malformed stack exceptions.
- AGENTS.md: Verified strict compliance with all repository rules: zero code comments added, valid Conventional Commits PR title, and no unauthorized files introduced.
- Note: the AI-assisted checkbox can stay.
Looks Good To Me
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.
What
Release an accepted but unpublished X509 lookup when the existing malformed-stack insertion guard throws. Invoke method.free and the matching allocation release as the normal failed-insertion path does; do not call shutdown for a lookup never published to the store.
Keep new_item refusal, successful insertion, ordinary growth failure and free-callback exception behavior unchanged. Trim only the documented leaked-lookup clause from debt; the console-unverified behavior and malformed-stack exceptions remain documented.
Tested
Linux, Ubuntu 24.04 under WSL2, GCC 13.3, Release; base
6fd2999417948562be633aa71629bab45d0e8b81, head91b8fe5e006bc3f922b2c9cb9f9063317f78ab5e, tree4170ddd41f1782b2ba4ca7ceb1eef48929af07c4.an unpublished lookup is freed when its stack insertion throws: one allocation remains unreleased.cmake --build build --target libs guest_libressl_x509_lookup_tests guest_libressl_x509_store_tests --parallel 8passes.ctest --test-dir build --no-tests=error --output-on-failure -R '^guest_libressl_x509_(lookup|lookup_allocator|store|store_allocator)$': 4/4 pass, zero skips.144ca190e778154c37fe2915f7941b0440995479; reproduce by taking only this head's changed test file(s) onto the base. Build configured withBUILD_TESTING=ON,FT_ENABLE_ERROR_STRINGS=OFF,CMAKE_LINK_DEPENDS_NO_SHARED=ON.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)