shithub: jbig2

Download patch

ref: d2072b4acf4f725c8e51a4c9ccd62dd0a110bd32
parent: 2c89cf17e395ced682defd9e1e3783e956cac022
author: Sebastian Rasmussen <sebras@gmail.com>
date: Fri Jun 7 09:29:40 EDT 2019

jbig2dec: Avoid double checks for negative coordinates.

Negative coordinates are already handled prior in the function
by falling back to the unoptimized case.

This was detected by Coverity in CID 303984 and CID 303985.

--- a/jbig2_image.c
+++ b/jbig2_image.c
@@ -290,20 +290,6 @@
     h = src->height;
     ss = src->data;
 
-    if (x < 0) {
-        if (w < (uint32_t) -x)
-            w = 0;
-        else
-            w += x;
-        x = 0;
-    }
-    if (y < 0) {
-        if (h < (uint32_t) -y)
-            h = 0;
-        else
-            h += y;
-        y = 0;
-    }
     w = ((uint32_t) x + w < dst->width) ? w : ((dst->width >= (uint32_t) x) ? dst->width - (uint32_t) x : 0);
     h = ((uint32_t) y + h < dst->height) ? h : ((dst->height >= (uint32_t) y) ? dst->height - (uint32_t) y : 0);
 #ifdef JBIG2_DEBUG