shithub: jbig2

Download patch

ref: 8aa97f4267efe94b814bd5fa9c9b0ce6312fc095
parent: f32d81e74bc34f5cd823b6f12e302e37814b3546
author: Sebastian Rasmussen <sebras@gmail.com>
date: Tue Apr 24 22:08:40 EDT 2018

jbig2dec: Check if all arithmetic decoder contexts are initialized.

Previously the IADT and IARI contexts were never checked for having
been successfully initialized, possibly causing uninitialized data
issues later.

--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -483,11 +483,11 @@
                                 tparams->IARDH = jbig2_arith_int_ctx_new(ctx);
                                 tparams->IARDX = jbig2_arith_int_ctx_new(ctx);
                                 tparams->IARDY = jbig2_arith_int_ctx_new(ctx);
-                                if ((tparams->IAID == NULL) || (tparams->IAFS == NULL) ||
+                                if ((tparams->IADT == NULL) || (tparams->IAFS == NULL) ||
                                     (tparams->IADS == NULL) || (tparams->IAIT == NULL) ||
-                                    (tparams->IAID == NULL) || (tparams->IARDW == NULL) ||
-                                    (tparams->IARDH == NULL) || (tparams->IARDX == NULL) ||
-                                    (tparams->IARDY == NULL)) {
+                                    (tparams->IAID == NULL) || (tparams->IARI == NULL) ||
+                                    (tparams->IARDW == NULL) || (tparams->IARDH == NULL) ||
+                                    (tparams->IARDX == NULL) || (tparams->IARDY == NULL)) {
                                     jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "out of memory creating text region arith decoder entries");
                                     goto cleanup4;
                                 }