punesemu/puNES

mapper 17, submapper 3 : possible buffer overflow

Closed this issue · 2 comments

possible buffer-overflow in mapper 17, submapper 3 (there is only one game, that SD gundam 3 thing)

this game sets wram @ 8K. by default extraram is 4096. The game sets trainer load address at $5F00, meaning it will use the extraRAM area, leaving only 256 bytes to copy to destination. but the trainer size is always 512 bytes causing overflow to occur (at least on my fork of fceumm). was the data suppose to overflow into the wram address (although the remaining 128 bytes only contains $00)?
not sure if you considered this and already padded your pointer destinations or was it a compiler option that has memcpy ignore the overflow area. Although your emu does not appear to cause issue, it may still be a possible problem.

As always, thank you very much for the report, I will check if I have the same problem.

I already handled this eventuality, thanks anyway for the warning.