Skip to content

Fix DecodeInvalidOpcode for 9-bit opcode codes - #2781

Merged
sbc100 merged 1 commit into
mainfrom
fix-decode-invalid-opcode
Jun 29, 2026
Merged

sbc100 merged 1 commit into
mainfrom
fix-decode-invalid-opcode

Conversation

@sbc100

@sbc100 sbc100 commented Jun 29, 2026

Copy link
Copy Markdown
Member

When MAX_OPCODE_BITS was increased to 9, DecodeInvalidOpcode still used a hardcoded 0xff mask when unpacking the invalid opcode code. This caused any invalid opcode with a code >= 0x100 (such as unsupported SIMD opcodes) to be truncated to 8 bits when reported in error messages.

Use ((1 << MAX_OPCODE_BITS) - 1) instead of 0xff so that 9-bit opcode codes are correctly preserved when reporting invalid opcodes.

See #2779

When MAX_OPCODE_BITS was increased to 9, DecodeInvalidOpcode still
used a hardcoded 0xff mask when unpacking the invalid opcode code.
This caused any invalid opcode with a code >= 0x100 (such as unsupported
SIMD opcodes) to be truncated to 8 bits when reported in error messages.

Use ((1 << MAX_OPCODE_BITS) - 1) instead of 0xff so that 9-bit opcode
codes are correctly preserved when reporting invalid opcodes.

See: #2779
@sbc100
sbc100 force-pushed the fix-decode-invalid-opcode branch from 2e35897 to 9a0eda7 Compare June 29, 2026 16:31
@sbc100
sbc100 requested a review from zherczeg June 29, 2026 16:31
@sbc100 sbc100 changed the title [opcode] Fix DecodeInvalidOpcode for 9-bit opcode codes Fix DecodeInvalidOpcode for 9-bit opcode codes Jun 29, 2026

@zherczeg zherczeg left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sbc100
sbc100 merged commit d75ec31 into main Jun 29, 2026
17 checks passed
@sbc100
sbc100 deleted the fix-decode-invalid-opcode branch June 29, 2026 22:34
@sbc100 sbc100 mentioned this pull request Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants