Skip to content

fix swapped isIntN arguments in Xtensa decodeOffset_16_16Operand#2988

Closed
Samin061 wants to merge 1 commit into
capstone-engine:nextfrom
Samin061:xtensa-isintn-args
Closed

fix swapped isIntN arguments in Xtensa decodeOffset_16_16Operand#2988
Samin061 wants to merge 1 commit into
capstone-engine:nextfrom
Samin061:xtensa-isintn-args

Conversation

@Samin061

@Samin061 Samin061 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Swapped isIntN arguments in decodeOffset_16_16Operand

isIntN(unsigned N, int64_t x) takes the bit width first, but the check here passes the decoded immediate as N, so it shifts by Imm - 1; a small Imm wraps that to a huge unsigned shift count and hits the signed shift/negation UBSan checks in MathExtras.h. Reachable from cs_disasm on Xtensa input that decodes an Offset_16_16 operand (e.g. 07 75 5d ce 50 2b 87), and every sibling decodeOffset_* helper already passes the width first. Added a regression case to test_poc.c.

@github-actions github-actions Bot added the Xtensa Arch label Jul 5, 2026
@Rot127

Rot127 commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

This is a clone of #2986

@Rot127 Rot127 closed this Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants