xtensa: fix swapped isIntN arguments in decodeOffset_16_16Operand#2986
Open
jmestwa-coder wants to merge 2 commits into
Open
xtensa: fix swapped isIntN arguments in decodeOffset_16_16Operand#2986jmestwa-coder wants to merge 2 commits into
jmestwa-coder wants to merge 2 commits into
Conversation
Rot127
approved these changes
Jul 4, 2026
Rot127
requested changes
Jul 4, 2026
Rot127
left a comment
Collaborator
There was a problem hiding this comment.
Sorry, clicked to fast. Please add the instruction to issues.yml as test case
Signed-off-by: Syed Mohammed Nayyar <jmestwa@gmail.com>
Contributor
Author
|
added the word to issues.yaml as a test case (ee.ldf.128.ip f8, f9, f7, f4, a2, 0). passes under cstest. |
Rot127
requested changes
Jul 6, 2026
| address: 0x0 | ||
| expected: | ||
| insns: | ||
| - asm_text: "ee.ldf.128.ip f8, f9, f7, f4, a2, 0" |
Collaborator
There was a problem hiding this comment.
Please also test the details. More test coverage is always better.
b1llow
approved these changes
Jul 6, 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.
Your checklist for this pull request
Detailed description
decodeOffset_16_16Operandpasses the untrusted immediate as the width argument toisIntN:isIntN(Imm, 8), but the signature isisIntN(unsigned N, int64_t x), soImmis used as the bit countisIntN(16, Imm)Immis a 4-bit field, soImm == 0shifts by(unsigned)(0 - 1)insideisIntN, which UBSan flags atMathExtras.h:62; it also wrongly rejects offsets 1..4Swapped the arguments back to
isIntN(8, Imm).Test plan
ee.ldf.128.ipwith a zero offset field reaches it:cstool -d esp32 2f704484. On an ASAN/UBSan build the old code aborts withshift exponent 4294967295 is too large; after the fix it decodes clean asee.ldf.128.ip f8, f9, f7, f4, a2, 0. Addedtest_ub_isintn_xtensa_offsettotests/integration/test_poc.cfor that word.Closing issues