Commit 3c58cc9
fix: rotate-by-32 UB in *_opcode_rorq + suppress padding noise
Round-2 sanitizer fix for PR #126:
UBSAN at src/tom/gpu.c:1684 -- "shift exponent 32 too large for
uint32_t". In gpu_opcode_rorq / dsp_opcode_rorq / DSP_rorq the
rotation count comes from gpu_convert_zero[] / dsp_convert_zero[],
which maps a 0 IMM_1 to 32 (rotate-by-0 means rotate-by-full-word,
a no-op). But `RN >> 32` is UB regardless of what the post-shift
result is, so the previous-commit fix (only masking the LHS) wasn't
enough.
Mask r1 to 0x1F before either shift -- maps 32 -> 0, preserving the
no-op semantic. Three sites:
- src/tom/gpu.c gpu_opcode_rorq
- src/jerry/dsp.c dsp_opcode_rorq, DSP_rorq
Also add `-clang-analyzer-optin.performance.Padding` to the disabled
list in .clang-tidy -- it fires on inherited UAE/Virtual Jaguar
struct layouts where reordering for tighter packing risks silent
layout breaks in save-state / dlsym paths.
Co-Authored-By: Claude Opus 4.7 <[email protected]>1 parent cbc22bf commit 3c58cc9
3 files changed
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
69 | 72 | | |
70 | 73 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1417 | 1417 | | |
1418 | 1418 | | |
1419 | 1419 | | |
1420 | | - | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
1421 | 1424 | | |
1422 | 1425 | | |
1423 | 1426 | | |
| |||
2233 | 2236 | | |
2234 | 2237 | | |
2235 | 2238 | | |
2236 | | - | |
| 2239 | + | |
| 2240 | + | |
2237 | 2241 | | |
2238 | 2242 | | |
2239 | 2243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1679 | 1679 | | |
1680 | 1680 | | |
1681 | 1681 | | |
1682 | | - | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
1683 | 1686 | | |
1684 | 1687 | | |
1685 | 1688 | | |
| |||
0 commit comments