fix(jsonrpc): harden ABI parser bounds and revert reason decoding#6711
Open
0xbigapple wants to merge 4 commits intotronprotocol:developfrom
Open
fix(jsonrpc): harden ABI parser bounds and revert reason decoding#67110xbigapple wants to merge 4 commits intotronprotocol:developfrom
0xbigapple wants to merge 4 commits intotronprotocol:developfrom
Conversation
alan-eth
reviewed
Apr 28, 2026
bladehan1
reviewed
Apr 28, 2026
bladehan1
reviewed
Apr 28, 2026
bladehan1
reviewed
Apr 28, 2026
bladehan1
reviewed
Apr 28, 2026
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 does this PR do?
This PR hardens ABI decoding for malformed dynamic data in both contract event parsing and JSON-RPC revert reason handling.
It:
subBytes: rejects negative or out-of-bounds offsets/lengths (no longer silently truncates oversized lengths viamin)parseDataBytes: rejects negative dynamic lengths instead of treating them as emptystring/bytestryDecodeRevertReasonto centralize duplicated revert error handling used byeth_callandeth_estimateGasWhy are these changes required?
Previously, malformed ABI payloads could:
subBytes()with invalid offsets or oversized lengthsstring/byteseth_callandeth_estimateGasThis PR has been tested by:
Unit Tests
:framework:test --tests org.tron.common.logsfilter.EventParserTest:framework:test --tests org.tron.core.services.jsonrpc.TronJsonRpcRevertReasonTest:framework:test --tests org.tron.core.jsonrpc.JsonRpcCallAndEstimateGasTest— end-to-end coverage ofeth_callandeth_estimateGasover revert/non-revert` pathsManual Testing
eth_calleth_estimateGasFollow up
Extra details