shithub: jbig2

Download patch

ref: 2c89cf17e395ced682defd9e1e3783e956cac022
parent: baba53ceaed7479cf17e7f4b7520a87af8d9caae
author: Sebastian Rasmussen <[email protected]>
date: Tue Jul 2 22:27:40 EDT 2019

jbig2dec: A small collection of code cleanups.

 * Refer to Jbig2ArithCx for memsetting in case it ever changes.
 * Fix typo.
 * Avoid using local variable when unnecessary.

--- a/jbig2.c
+++ b/jbig2.c
@@ -384,7 +384,7 @@
             if (ctx->state == JBIG2_FILE_RANDOM_BODIES) {
                 if (ctx->segment_index == ctx->n_segments)
                     ctx->state = JBIG2_FILE_EOF;
-            } else {            /* JBIG2_FILE_SEQUENCIAL_BODY */
+            } else {            /* JBIG2_FILE_SEQUENTIAL_BODY */
                 ctx->state = JBIG2_FILE_SEQUENTIAL_HEADER;
             }
             if (code < 0) {
--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -1034,7 +1034,7 @@
             jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to allocate arithmetic decoder states for generic regions");
             goto cleanup;
         }
-        memset(GB_stats, 0, stats_size);
+        memset(GB_stats, 0, sizeof (Jbig2ArithCx) * stats_size);
 
         stats_size = params.SDRTEMPLATE ? 1 << 10 : 1 << 13;
         GR_stats = jbig2_new(ctx, Jbig2ArithCx, stats_size);
--- a/jbig2_text.c
+++ b/jbig2_text.c
@@ -221,9 +221,8 @@
         jbig2_release_huffman_table(ctx, runcodes);
 
         if (SBSYMCODES == NULL) {
-            code = jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to construct symbol ID huffman table");
             jbig2_huffman_free(ctx, hs);
-            return code;
+            return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to construct symbol ID huffman table");
         }
     }