Description: Fix warnings: remove unsigned < 0 tests that are always false Origin: git://git.ghostscript.com/jbig2dec.git;a=commit;h=9d2c4f3 Author: Tor Andersson <tor.andersson@artifex.com> Forwarded: yes Last-Update: 2017-01-23 --- a/jbig2_image.c +++ b/jbig2_image.c @@ -256,7 +256,7 @@ /* general OR case */ s = ss; d = dd = dst->data + y * dst->stride + leftbyte; - if (d < dst->data || leftbyte > dst->stride || h * dst->stride < 0 || d - leftbyte + h * dst->stride > dst->data + dst->height * dst->stride) { + if (d < dst->data || leftbyte > dst->stride || d - leftbyte + h * dst->stride > dst->data + dst->height * dst->stride) { return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "preventing heap overflow in jbig2_image_compose"); } if (leftbyte == rightbyte) { --- a/jbig2_mmr.c +++ b/jbig2_mmr.c @@ -977,7 +977,7 @@ if (b1 < 2) break; if (c) { - if (b1 - 2 < a0 || a0 < 0) + if (a0 == MINUS1 || b1 - 2 < a0) return -1; jbig2_set_bits(dst, a0, b1 - 2); } --- a/jbig2_symbol_dict.c +++ b/jbig2_symbol_dict.c @@ -92,11 +92,6 @@ { Jbig2SymbolDict *new_dict = NULL; - if (n_symbols < 0) { - jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "Negative number of symbols in symbol dict: %d", n_symbols); - return NULL; - } - new_dict = jbig2_new(ctx, Jbig2SymbolDict, 1); if (new_dict != NULL) { new_dict->glyphs = jbig2_new(ctx, Jbig2Image *, n_symbols); @@ -613,7 +608,7 @@ uint32_t j; int x; - if (code || (BMSIZE < 0)) { + if (code) { jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "error decoding size of collective bitmap!"); goto cleanup4; } @@ -716,7 +711,7 @@ code = jbig2_arith_int_decode(IAEX, as, (int32_t *)&exrunlength); /* prevent infinite loop */ zerolength = exrunlength > 0 ? 0 : zerolength + 1; - if (code || (exrunlength > limit - i) || (exrunlength < 0) || (zerolength > 4) || (exflag && (exrunlength + j > params->SDNUMEXSYMS))) { + if (code || (exrunlength > limit - i) || (zerolength > 4) || (exflag && (exrunlength + j > params->SDNUMEXSYMS))) { if (code) jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to decode exrunlength for exported symbols"); else if (exrunlength <= 0)