shithub: jbig2

Download patch

ref: 632bada9f1e04ff4c1391445c90d0eeed6fd3170
parent: 88c8ff2d573fde32629b4dc016e5240814123679
author: Sebastian Rasmussen <sebras@gmail.com>
date: Fri Dec 7 13:12:23 EST 2018

Bug 700384: Indicate error upon error, do not just warn.

Building a Huffman table failed, this was correctly detected,
but success was indicated to the caller causing a reference
template to be left uninitialized, which later on caused the
generic refinement region decoder attempt to use this
uninitialized data. This was reported by MSAN.

Thanks to oss-fuzz for reporting.

--- a/jbig2_text.c
+++ b/jbig2_text.c
@@ -219,9 +219,9 @@
         jbig2_release_huffman_table(ctx, runcodes);
 
         if (SBSYMCODES == NULL) {
-            jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to construct symbol ID huffman table");
+            code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to construct symbol ID huffman table");
             jbig2_huffman_free(ctx, hs);
-            return ((code != 0) ? code : -1);
+            return code;
         }
     }