From 81cbff917f965bf7fab35cb42d68ebf14a880aa5 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Fri, 17 Apr 2015 06:18:43 +0200 Subject: [PATCH] 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. --- sys/src/cmd/gs/src/gxclrast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/src/cmd/gs/src/gxclrast.c b/sys/src/cmd/gs/src/gxclrast.c index a0e9a7632..0c0361388 100644 --- a/sys/src/cmd/gs/src/gxclrast.c +++ b/sys/src/cmd/gs/src/gxclrast.c @@ -119,7 +119,7 @@ private void 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; }