fix: Guard against null SLE in NoRippleCheck and GatewayBalances callbacks - #7827
Open
SAY-5 wants to merge 2 commits into
Open
fix: Guard against null SLE in NoRippleCheck and GatewayBalances callbacks#7827SAY-5 wants to merge 2 commits into
SAY-5 wants to merge 2 commits into
Conversation
…backs Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
|
If only the most recent commit is unsigned, you can run:
If multiple commits are unsigned, you can run:
If you're new to commit signing, there are different ways to set it up: Sign commits with
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
High Level Overview of Change
The
forEachItemAftercallback indoNoRippleCheckand theforEachItemcallback indoGatewayBalancesdereference theSLEargument (ownedItem/sle) without checking for null first. The sibling account handlers (doAccountLines,doAccountChannels,doAccountOffers) all guard their directory callbacks with aif (!sle) { UNREACHABLE(...); return; }block. This adds the same guard to the two handlers that were missing it, so all directory-iteration callbacks are consistent. Fixes #7510.Context of Change
Both callbacks receive the SLE via
view.read()inside the directory helpers. In normal operationread()returns a valid entry, but the other account handlers already treat a null result as an unreachable-but-guarded case rather than dereferencing it. This change closes that inconsistency; the guard uses the existingUNREACHABLEmacro withLCOV_EXCL_START/LCOV_EXCL_STOPmarkers, matchingAccountLines.cpp.API Impact
libxrplchange (any change that may affectlibxrplor dependents oflibxrpl)Test Plan
The null-SLE path is defensive and not reachable through the existing RPC unit tests without a corrupted ledger, so it is marked with
LCOV_EXCLlike the equivalent guard inAccountLines.cpp. The existingNoRippleCheckandGatewayBalancestest suites exercise the normal (non-null) path and continue to pass. The change is formatted with the repository.clang-format.