AndreaOrru / LaiNES

Cycle-accurate NES emulator in ~1000 lines of code
BSD 2-Clause "Simplified" License
1.49k stars 122 forks source link

Buffer overflow #31

Closed ghost closed 4 years ago

ghost commented 6 years ago

Hi, there appears to be a global buffer overflow caused by line 187 here:

https://github.com/AndreaOrru/LaiNES/blob/52b7920d9878962adf50fdeb14f3e65906db57d9/src/ppu.cpp#L181-L187

Because n is allowed to be 8, the next loop iteration where n == 8 overflows the secOam buffer because it can only hold 8 elements.

AndreaOrru commented 6 years ago

Haven't looked at this code in a while - it looks like you're right though. Have you already tried compiling it with ++n >= 8?

ghost commented 6 years ago

Yes the error seems to go away with that.

AndreaOrru commented 4 years ago

Closed by #37