X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=plugins%2Fgpulib%2Fgpu.c;h=d67df03c39a4e5d89d74f34f99b4e5b445ae6004;hp=f2bf6ce9e14e280ec3323bd0290640aad111e30b;hb=HEAD;hpb=24a7af90024e950ee1d2d39518743904f4b164f5 diff --git a/plugins/gpulib/gpu.c b/plugins/gpulib/gpu.c index f2bf6ce9..b444dcf5 100644 --- a/plugins/gpulib/gpu.c +++ b/plugins/gpulib/gpu.c @@ -532,6 +532,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: @@ -571,11 +575,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