summaryrefslogtreecommitdiff
path: root/render/html_object.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2013-11-03 22:51:43 +0000
committerVincent Sanders <vince@kyllikki.org>2013-11-03 22:51:43 +0000
commitaa4d2eb608e1121bda698036915b3c5268b32e4d (patch)
treea13703fd42c835ac105eea03cded0b94ea8badba /render/html_object.c
parentc26dd436697439cf2191d7ab74bde2cbfe601b4f (diff)
downloadnetsurf-aa4d2eb608e1121bda698036915b3c5268b32e4d.tar.gz
netsurf-aa4d2eb608e1121bda698036915b3c5268b32e4d.tar.bz2
ensure no division by zero can occour (coverity 1109862 1109863)
Diffstat (limited to 'render/html_object.c')
-rw-r--r--render/html_object.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/render/html_object.c b/render/html_object.c
index e66667b14..f4975e9ba 100644
--- a/render/html_object.c
+++ b/render/html_object.c
@@ -299,15 +299,24 @@ html_object_callback(hlcache_handle *object,
int w = content_get_width(object);
int h = content_get_height(object);
- data.redraw.x = data.redraw.x *
+ if (w != 0) {
+ data.redraw.x =
+ data.redraw.x *
box->width / w;
- data.redraw.y = data.redraw.y *
- box->height / h;
- data.redraw.width = data.redraw.width *
+ data.redraw.width =
+ data.redraw.width *
box->width / w;
- data.redraw.height =
+ }
+
+ if (h != 0) {
+ data.redraw.y =
+ data.redraw.y *
+ box->height / h;
+ data.redraw.height =
data.redraw.height *
box->height / h;
+ }
+
data.redraw.object_width = box->width;
data.redraw.object_height = box->height;
}