X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=plugins%2Fgpulib%2Fgpu.c;fp=plugins%2Fgpulib%2Fgpu.c;h=289e286b05708a3c9dbe88938a649f96a17e322b;hb=bbb7cdecc2d22277a639bb4d091e0b66c7ce57e8;hp=c0603e08ed02ba067d79afb3975786a62fcac68d;hpb=2b2ac30d6905b3434d822c223b36957aef96a857;p=pcsx_rearmed.git diff --git a/plugins/gpulib/gpu.c b/plugins/gpulib/gpu.c index c0603e08..289e286b 100644 --- a/plugins/gpulib/gpu.c +++ b/plugins/gpulib/gpu.c @@ -576,6 +576,10 @@ static noinline int do_cmd_list_skip(uint32_t *data, int count, int *last_cmd) uint32_t *list = data + pos; cmd = LE32TOH(list[0]) >> 24; len = 1 + cmd_lengths[cmd]; + if (pos + len > count) { + cmd = -1; + break; // incomplete cmd + } switch (cmd) { case 0x02: @@ -615,11 +619,6 @@ static noinline int do_cmd_list_skip(uint32_t *data, int count, int *last_cmd) gpu.ex_regs[cmd & 7] = LE32TOH(list[0]); break; } - - if (pos + len > count) { - cmd = -1; - break; // incomplete cmd - } if (0x80 <= cmd && cmd <= 0xdf) break; // image i/o