all repos — mgba @ 75e609f65cec1e3e7336f305dda75eac4e17f0ab

mGBA Game Boy Advance Emulator

GB: Drop invalid SGB packets
Vicki Pfau vi@endrift.com
Thu, 03 Aug 2017 19:35:00 -0700
commit

75e609f65cec1e3e7336f305dda75eac4e17f0ab

parent

da10c3bbeccb4e445f1e7bdcb28e86024723e6d6

1 files changed, 4 insertions(+), 0 deletions(-)

jump to
M src/gb/video.csrc/gb/video.c

@@ -552,6 +552,10 @@

void GBVideoWriteSGBPacket(struct GBVideo* video, uint8_t* data) { int i; if (!(video->sgbCommandHeader & 7)) { + if ((data[0] >> 3) > SGB_OBJ_TRN) { + video->sgbCommandHeader = 0; + return; + } video->sgbCommandHeader = data[0]; } --video->sgbCommandHeader;