RPGHacker / asar

(Now) official repository of the SNES assembler Asar, originally created by Alcaro
Other
199 stars 42 forks source link

relative branch out of bounds is not checked for SPC700 bbs/bbc commands #271

Closed ghost closed 7 months ago

ghost commented 1 year ago

https://github.com/RPGHacker/asar/blob/master/src/asar/arch-spc700.cpp#L366 affected line, bbs1/bbc1 are branch commands depending on the bit and can only support ranges up to 128

bad hotfix: int len = getlen(arg[1]); int ddss = (int)getnum64(arg[1]); int pos = (len == 1) ? ddss : ddss - (snespos + 1); if (pass && foundlabel && (pos < -128 || pos>127)) asar_throw_error(2, error_type_block, error_id_relative_branch_out_of_bounds, dec(pos).data()); write1((unsigned int)pos);

KungFuFurby commented 1 year ago

Duplicate of #219.