shithub: jbig2

Download patch

ref: 36eea46cc5e00f504952353091210b095c7587f7
parent: c953ed5d949081ed0da2663246b5c19388ea1698
author: Sebastian Rasmussen <sebras@gmail.com>
date: Mon Jun 18 14:48:49 EDT 2018

jbig2dec: Handle very large symbol code lengths without overflowing.

--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -342,7 +342,7 @@
         tparams.IADS = jbig2_arith_int_ctx_new(ctx);
         tparams.IAIT = jbig2_arith_int_ctx_new(ctx);
         /* Table 31 */
-        for (SBSYMCODELEN = 0; (1 << SBSYMCODELEN) < (int)(params->SDNUMINSYMS + params->SDNUMNEWSYMS); SBSYMCODELEN++);
+        for (SBSYMCODELEN = 0; ((uint64_t) 1 << SBSYMCODELEN) < ((uint64_t) params->SDNUMINSYMS + params->SDNUMNEWSYMS); SBSYMCODELEN++);
         tparams.IAID = jbig2_arith_iaid_ctx_new(ctx, SBSYMCODELEN);
         tparams.IARI = jbig2_arith_int_ctx_new(ctx);
         tparams.IARDW = jbig2_arith_int_ctx_new(ctx);