Skip to content

Commit

Permalink
Fix UBSan warning in arithmetic decoder
Browse files Browse the repository at this point in the history
Very similar to the ones that were fixed in the Huffman decoders in
8e9cef2.  These are innocuous.

Refer to https://bugzilla.mozilla.org/show_bug.cgi?id=1304567.
  • Loading branch information
dcommander committed Sep 22, 2016
1 parent dfefba7 commit ac4a899
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion jdarith.c
Expand Up @@ -21,6 +21,9 @@
#include "jpeglib.h"


#define NEG_1 ((unsigned int)-1)


/* Expanded entropy decoder object for arithmetic decoding. */

typedef struct {
Expand Down Expand Up @@ -450,7 +453,7 @@ decode_mcu_AC_refine (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
tbl = cinfo->cur_comp_info[0]->ac_tbl_no;

p1 = 1 << cinfo->Al; /* 1 in the bit position being coded */
m1 = (-1) << cinfo->Al; /* -1 in the bit position being coded */
m1 = (NEG_1) << cinfo->Al; /* -1 in the bit position being coded */

/* Establish EOBx (previous stage end-of-block) index */
for (kex = cinfo->Se; kex > 0; kex--)
Expand Down

0 comments on commit ac4a899

Please sign in to comment.