capstone-engine / capstone

Capstone disassembly/disassembler framework for ARM, ARM64 (ARMv8), Alpha, BPF, Ethereum VM, HPPA, LoongArch, M68K, M680X, Mips, MOS65XX, PPC, RISC-V(rv32G/rv64G), SH, Sparc, SystemZ, TMS320C64X, TriCore, Webassembly, XCore and X86.
http://www.capstone-engine.org
7.18k stars 1.52k forks source link

Fix comparison using narrow types in loop condition #2360

Closed trufae closed 1 month ago

trufae commented 1 month ago

Detailed description

The type of the looping variable is smaller than the one used to end the loop. So it is possible to cause an infinite loop because of the wraparound.

Test plan

Probably next is affected too. But i'm lazy to test other branches right now.

Closing issues

There are no issues refering to this issue