Skip to content

Commit

Permalink
Ensure that default Huffman tables are initialized
Browse files Browse the repository at this point in the history
This prevents a malformed motion-JPEG frame (MJPEG frames lack Huffman
tables) from causing the "fast path" of the Huffman decoder to read
uninitialized memory.  Essentially, this is doing the same thing for
MJPEG frames as 43d8cf4 did for regular
images.
  • Loading branch information
dcommander committed Mar 6, 2016
1 parent f57bae0 commit a572622
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ decoder only if there are > 512 bytes of data in the input buffer.
[3] Fixed a memory leak in tjunittest encountered when running the program
with the -yuv option.

[4] Fixed an issue whereby a malformed motion-JPEG frame could cause the "fast
path" of libjpeg-turbo's Huffman decoder to read from uninitialized memory.


1.4.2
=====
Expand Down
1 change: 1 addition & 0 deletions jstdhuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ add_huff_table (j_common_ptr cinfo,
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);

MEMCOPY((*htblptr)->huffval, val, nsymbols * sizeof(UINT8));
MEMZERO(&((*htblptr)->huffval[nsymbols]), (256 - nsymbols) * sizeof(UINT8));

/* Initialize sent_table FALSE so table will be written to JPEG file. */
(*htblptr)->sent_table = FALSE;
Expand Down

0 comments on commit a572622

Please sign in to comment.