shithub: jbig2

Download patch

ref: b2fb8f740bd1a88af47aa6875848049094d9cd84
parent: d2072b4acf4f725c8e51a4c9ccd62dd0a110bd32
author: Sebastian Rasmussen <[email protected]>
date: Wed Jun 12 14:52:44 EDT 2019

jbig2dec: Validate range of Huffman Table range values.

Detected by Coverity in CID 94835.

--- a/jbig2_huffman.c
+++ b/jbig2_huffman.c
@@ -583,6 +583,11 @@
                     code_table_flags, HTOOB, HTPS, HTRS, HTLOW, HTHIGH);
 #endif
 
+        if (HTLOW >= HTHIGH) {
+            jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "invalid Huffman Table range");
+            goto error_exit;
+        }
+
         /* allocate HuffmanParams & HuffmanLine */
         params = jbig2_new(ctx, Jbig2HuffmanParams, 1);
         if (params == NULL) {