diff options
author | Nick Kralevich <nnk@google.com> | 2013-10-11 13:13:33 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-10-11 13:13:33 -0700 |
commit | 40dfc1d1a9742d1ea7452fd0d08765d5b595e813 (patch) | |
tree | cbd637a2ec35b4df8d1f4aadb08e5d36a0344452 | |
parent | 6f1b7fb8079197d4a4edc5d2e5c5546302197f33 (diff) | |
parent | 8fe7969dd0b193bce2d25c9367c5f4ad1d9e8ff3 (diff) | |
download | jpeg-40dfc1d1a9742d1ea7452fd0d08765d5b595e813.tar.gz |
am 8fe7969d: am dc20ac98: improve the handling of images with duplicate component IDs
* commit '8fe7969dd0b193bce2d25c9367c5f4ad1d9e8ff3':
improve the handling of images with duplicate component IDs
-rw-r--r-- | jdmarker.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -302,7 +302,7 @@ get_sos (j_decompress_ptr cinfo) /* Process a SOS marker */ { INT32 length; - int i, ci, n, c, cc; + int i, ci, n, c, cc, pi; jpeg_component_info * compptr; INPUT_VARS(cinfo); @@ -342,6 +342,12 @@ get_sos (j_decompress_ptr cinfo) TRACEMS3(cinfo, 1, JTRC_SOS_COMPONENT, cc, compptr->dc_tbl_no, compptr->ac_tbl_no); + + /* This CSi (cc) should differ from the previous CSi */ + for (pi = 0; pi < i; pi++) { + if (cinfo->cur_comp_info[pi] == compptr) + ERREXIT1(cinfo, JERR_BAD_COMPONENT_ID, cc); + } } /* Collect the additional scan parameters Ss, Se, Ah/Al. */ @@ -459,6 +465,8 @@ get_dht (j_decompress_ptr cinfo) for (i = 0; i < count; i++) INPUT_BYTE(cinfo, huffval[i], return FALSE); + MEMZERO(&huffval[count], (256 - count) * SIZEOF(UINT8)); + length -= count; if (index & 0x10) { /* AC table definition */ |