summaryrefslogtreecommitdiff
path: root/render/html_object.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2013-10-25 22:06:29 +0100
committerVincent Sanders <vince@netsurf-browser.org>2013-10-25 22:06:29 +0100
commit4776f05430e1b8002e6ca6eec3e69f84fa130eda (patch)
treea944a6064b72cb91027c876004f6a155c22766c6 /render/html_object.c
parent6b29a697b9879c03146cca24bb30c64d25810cb8 (diff)
downloadnetsurf-4776f05430e1b8002e6ca6eec3e69f84fa130eda.tar.gz
netsurf-4776f05430e1b8002e6ca6eec3e69f84fa130eda.tar.bz2
fix potential division by zero by only computing width and height when content is valid and hence will return content width and height not zero. coverity 110986[23]
Diffstat (limited to 'render/html_object.c')
-rw-r--r--render/html_object.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/render/html_object.c b/render/html_object.c
index f7ed3bd94..e66667b14 100644
--- a/render/html_object.c
+++ b/render/html_object.c
@@ -293,10 +293,12 @@ html_object_callback(hlcache_handle *object,
} else {
/* Non-background case */
- int w = content_get_width(object);
- int h = content_get_height(object);
if (hlcache_handle_get_content(object) ==
event->data.redraw.object) {
+
+ int w = content_get_width(object);
+ int h = content_get_height(object);
+
data.redraw.x = data.redraw.x *
box->width / w;
data.redraw.y = data.redraw.y *