shithub: riscv

Download patch

ref: 81cbff917f965bf7fab35cb42d68ebf14a880aa5
parent: 57ad566dfc30b250229852619fc1073d47375dfa
author: cinap_lenrek <[email protected]>
date: Fri Apr 17 02:18:43 EDT 2015

gs: avoid 6c type propagation / constant folding issue for set_cb_end()

6c changed "- cmd_lagest_size + 1" into a *unsigned* 32bit constant. which
got added to 64bit pointer making pcb->limit > pcb->end resulting
in errors for partial commands in the buffer. removing the parentesis
propagates the operation to 64bit.

--- a/sys/src/cmd/gs/src/gxclrast.c
+++ b/sys/src/cmd/gs/src/gxclrast.c
@@ -119,7 +119,7 @@
 set_cb_end(command_buf_t *pcb, const byte *end)
 {
     pcb->end = end;
-    pcb->limit = pcb->data + (pcb->size - cmd_largest_size + 1);
+    pcb->limit = pcb->data + pcb->size - cmd_largest_size + 1;
     if ( pcb->limit > pcb->end )
 	pcb->limit = pcb->end;
 }