diff options
author | Adrian Lees <adrian@aemulor.com> | 2009-02-02 23:17:41 +0000 |
---|---|---|
committer | Adrian Lees <adrian@aemulor.com> | 2009-02-02 23:17:41 +0000 |
commit | 9984ea5f113ff0350989b44351a9c7b0c41915fc (patch) | |
tree | ae3212c9044e7c1406edf1b0320b4717741e9f5b /riscos | |
parent | 2138d4f3278d499f26ec10fff52f113d806e9a93 (diff) | |
download | netsurf-9984ea5f113ff0350989b44351a9c7b0c41915fc.tar.gz netsurf-9984ea5f113ff0350989b44351a9c7b0c41915fc.tar.bz2 |
Protect NS from DrawFiles it generated
svn path=/trunk/netsurf/; revision=6358
Diffstat (limited to 'riscos')
-rw-r--r-- | riscos/draw.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/riscos/draw.c b/riscos/draw.c index b30e98dfb..7e0c8c2a1 100644 --- a/riscos/draw.c +++ b/riscos/draw.c @@ -61,10 +61,16 @@ bool draw_convert(struct content *c, int width, int height) return false; } - /* c->width & c->height stored as (OS units/2) - => divide by 512 to convert from draw units */ - c->width = ((bbox.x1 - bbox.x0) / 512); - c->height = ((bbox.y1 - bbox.y0) / 512); + if (bbox.x1 > bbox.x0 && bbox.y1 > bbox.y0) { + /* c->width & c->height stored as (OS units/2) + => divide by 512 to convert from draw units */ + c->width = ((bbox.x1 - bbox.x0) / 512); + c->height = ((bbox.y1 - bbox.y0) / 512); + } + else + /* invalid/undefined bounding box */ + c->height = c->width = 0; + c->data.draw.x0 = bbox.x0; c->data.draw.y0 = bbox.y0; c->title = malloc(100); @@ -103,6 +109,9 @@ bool draw_redraw(struct content *c, int x, int y, if (plot.flush && !plot.flush()) return false; + if (!c->width || !c->height) + return false; + /* Scaled image. Transform units (65536*OS units) */ matrix.entries[0][0] = width * 65536 / c->width; matrix.entries[0][1] = 0; |