shithub: jbig2

Download patch

ref: 7851efb8cd3cad063e40a78883c011e1a158ce4a
parent: a61cbd41c67f7aef893075a3521090659887a995
author: Sebastian Rasmussen <[email protected]>
date: Wed May 23 23:27:21 EDT 2018

jbig2dec: Differentiate between errors/OOB when decoding BMSIZE.

Previously the two very lumped together, causing a single error message.

--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -655,11 +655,12 @@
         if (params->SDHUFF && !params->SDREFAGG) {
             /* 6.5.9 */
             Jbig2Image *image;
-            uint32_t BMSIZE = jbig2_huffman_get(hs, params->SDHUFFBMSIZE, &code);
+            uint32_t BMSIZE;
             uint32_t j;
             int x;
 
-            if (code) {
+            BMSIZE = jbig2_huffman_get(hs, params->SDHUFFBMSIZE, &code);
+            if (code < 0) {
                 jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "error decoding size of collective bitmap");
                 goto cleanup4;
             }