GB: Drop invalid SGB packets
Vicki Pfau vi@endrift.com
Thu, 03 Aug 2017 19:35:00 -0700
1 files changed,
4 insertions(+),
0 deletions(-)
jump to
M
src/gb/video.c
→
src/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;