tlibmemdraw: fix int size bug - plan9port - [fork] Plan 9 from user space
HTML git clone git://src.adamsgaard.dk/plan9port
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 33cdf63251a23d71906cb482bce4ca02ce6d94c0
DIR parent c5bfba483f4002c539cbeb4087827524dba8d0f8
HTML Author: Erik Quanstrom <quanstro@quanstro.net>
Date: Sun, 21 Oct 2012 12:08:49 -0400
libmemdraw: fix int size bug
R=rsc, quanstro
CC=plan9port.codebot
http://codereview.appspot.com/6657043
Diffstat:
M src/libmemdraw/alloc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
DIR diff --git a/src/libmemdraw/alloc.c b/src/libmemdraw/alloc.c
t@@ -141,7 +141,8 @@ byteaddr(Memimage *i, Point p)
{
uchar *a;
- a = i->data->bdata+i->zero+sizeof(u32int)*p.y*i->width;
+ /* careful to sign-extend negative p.y for 64-bits */
+ a = i->data->bdata+i->zero+(int)(sizeof(u32int)*p.y*i->width);
if(i->depth < 8){
/*