Skip to content

M68K: Handle minimum signed displacements - #3041

Closed
carrerasdarren-cell wants to merge 1 commit into
capstone-engine:nextfrom
carrerasdarren-cell:fix/m68k-int32-displacement
Closed

M68K: Handle minimum signed displacements#3041
carrerasdarren-cell wants to merge 1 commit into
capstone-engine:nextfrom
carrerasdarren-cell:fix/m68k-int32-displacement

Conversation

@carrerasdarren-cell

Copy link
Copy Markdown

Your checklist for this pull request

  • I've documented or updated the documentation of every API function and struct this PR changes.
  • I've added tests that prove my fix is effective or that my feature works (if possible)

Detailed description

M68K displacement printing currently calls abs() on signed 32-bit values. abs(INT32_MIN) cannot be represented by int, so the operation has undefined behavior and triggers the public OSS-Fuzz report 484248078.

Convert negative displacements through a signed 64-bit intermediate before narrowing their magnitude to uint32_t. Apply the helper to base, inner, and outer 32-bit displacement formatting. Add regression coverage for both base-displacement and memory-indirect encodings at INT32_MIN.

Test plan

  • xcrun clang-format --dry-run --Werror arch/M68K/M68KInstPrinter.c
  • ASan/UBSan build with the original nine-byte OSS-Fuzz testcase
  • ASan/UBSan disassembly of both new INT32_MIN cases
  • cstest tests/details/m68k.yaml (444 tests passed)
  • git diff --check

Closing issues

Closes #3040

@github-actions github-actions Bot added the M68K Arch label Aug 21, 2026
@carrerasdarren-cell

Copy link
Copy Markdown
Author

Closing this after finding #2990, which covers the same three M68K INT32_MIN displacement sites and already follows the requested SStream-helper design. I missed that prior work in the pre-publication search; apologies for the duplicate and reviewer noise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

M68K Arch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

M68K: INT32_MIN displacement triggers signed overflow in printer

1 participant