shithub: jbig2

Download patch

ref: 93ce4f96674d6a9dbd7b03a28991fb37065ceee2
parent: ca14bdc950cca9c7e6abf1b617af3ad4d1c9dda7
author: Sebastian Rasmussen <sebras@gmail.com>
date: Mon May 28 22:58:14 EDT 2018

jbig2dec: Remove denial of service check which is no longer needed.

In commit ee0bc20cc98c8e8381003a25dfa0b21e681c6545 an attempt to detect the end
of the arithmetic integer decoder bit stream is detected. Now once more error
handling has been implemented, the files from bug 694949 that caused this end of
bitstream detection code to be added no longer end in an infinite loop, but fail
with fatal errors due to other reasons.

--- a/jbig2_arith.c
+++ b/jbig2_arith.c
@@ -320,12 +320,6 @@
     }
 }
 
-bool
-jbig2_arith_has_reached_marker(Jbig2ArithState *as)
-{
-    return as->next_word_bytes == 2 && (as->next_word >> 16) > 0xFF8F;
-}
-
 #ifdef TEST
 
 static const byte test_stream[] = {
--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -387,11 +387,6 @@
             goto cleanup;
         }
 
-        if (!params->SDHUFF && jbig2_arith_has_reached_marker(as)) {
-            code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "prevent DOS while decoding height classes");
-            goto cleanup;
-        }
-
         /* 6.5.5 (4b) */
         HCHEIGHT = HCHEIGHT + HCDH;
         SYMWIDTH = 0;