notaz.gp2x.de
/
pcsx_rearmed.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4ebf579
)
gpulib: don't corrupt memory on garbage commands
author
notaz
<notasas@gmail.com>
Sun, 27 Aug 2023 20:21:36 +0000
(23:21 +0300)
committer
notaz
<notasas@gmail.com>
Sun, 27 Aug 2023 23:06:02 +0000
(
02:06
+0300)
plugins/gpulib/gpu.c
patch
|
blob
|
blame
|
history
diff --git
a/plugins/gpulib/gpu.c
b/plugins/gpulib/gpu.c
index
40a6bd8
..
d70e366
100644
(file)
--- a/
plugins/gpulib/gpu.c
+++ b/
plugins/gpulib/gpu.c
@@
-690,6
+690,10
@@
long GPUdmaChain(uint32_t *rambase, uint32_t start_addr, uint32_t *progress_addr
log_io(".chain %08lx #%d+%d\n",
(long)(list - rambase) * 4, len, gpu.cmd_len);
if (unlikely(gpu.cmd_len > 0)) {
+ if (gpu.cmd_len + len > ARRAY_SIZE(gpu.cmd_buffer)) {
+ log_anomaly("cmd_buffer overflow, likely garbage commands\n");
+ gpu.cmd_len = 0;
+ }
memcpy(gpu.cmd_buffer + gpu.cmd_len, list + 1, len * 4);
gpu.cmd_len += len;
flush_cmd_buffer();