Merge pull request #654 from mayeut/master

Fix undefined size jp2 box handling
This commit is contained in:
Matthieu Darbois 2015-11-07 14:35:45 +01:00
commit 51cbcd5748
4 changed files with 26 additions and 16 deletions

View File

@ -484,8 +484,12 @@ static OPJ_BOOL opj_jp2_read_boxhdr(opj_jp2_box_t *box,
if(box->length == 0)/* last box */ if(box->length == 0)/* last box */
{ {
const OPJ_OFF_T bleft = opj_stream_get_number_byte_left(cio); const OPJ_OFF_T bleft = opj_stream_get_number_byte_left(cio);
box->length = (OPJ_UINT32)bleft; if (bleft > (OPJ_OFF_T)(0xFFFFFFFFU - 8U)) {
assert( (OPJ_OFF_T)box->length == bleft ); opj_event_msg(p_manager, EVT_ERROR, "Cannot handle box sizes higher than 2^32\n");
return OPJ_FALSE;
}
box->length = (OPJ_UINT32)bleft + 8U;
assert( (OPJ_OFF_T)box->length == bleft + 8 );
return OPJ_TRUE; return OPJ_TRUE;
} }

View File

@ -269,3 +269,4 @@ e163102afcc857cf001337178241f518 issue559-eci-090-CIELab.jp2_2.pgx
b004b2e08b0dfb217c131b353cf157eb issue559-eci-091-CIELab.jp2_0.pgx b004b2e08b0dfb217c131b353cf157eb issue559-eci-091-CIELab.jp2_0.pgx
2400da6b8ed6b1747b9913af544580f9 issue559-eci-091-CIELab.jp2_1.pgx 2400da6b8ed6b1747b9913af544580f9 issue559-eci-091-CIELab.jp2_1.pgx
cf73dda887967928dbcf5cc87ab204cc issue559-eci-091-CIELab.jp2_2.pgx cf73dda887967928dbcf5cc87ab204cc issue559-eci-091-CIELab.jp2_2.pgx
3bf91c974abc17e520c6a5efa883a58a issue653-zero-unknownbox.jp2.png

View File

@ -505,3 +505,6 @@ opj_decompress -i @INPUT_NR_PATH@/issue236-ESYCC-CDEF.jp2 -o @TEMP_PATH@/issue23
# issue 326 + PR 559: CIELab colorspace # issue 326 + PR 559: CIELab colorspace
opj_decompress -i @INPUT_NR_PATH@/issue559-eci-090-CIELab.jp2 -o @TEMP_PATH@/issue559-eci-090-CIELab.jp2.pgx opj_decompress -i @INPUT_NR_PATH@/issue559-eci-090-CIELab.jp2 -o @TEMP_PATH@/issue559-eci-090-CIELab.jp2.pgx
opj_decompress -i @INPUT_NR_PATH@/issue559-eci-091-CIELab.jp2 -o @TEMP_PATH@/issue559-eci-091-CIELab.jp2.pgx opj_decompress -i @INPUT_NR_PATH@/issue559-eci-091-CIELab.jp2 -o @TEMP_PATH@/issue559-eci-091-CIELab.jp2.pgx
# issue 653 Last box of undefined size byg
opj_decompress -i @INPUT_NR_PATH@/issue653-zero-unknownbox.jp2 -o @TEMP_PATH@/issue653-zero-unknownbox.jp2.png -p 8S

View File

@ -70,6 +70,8 @@ if [ "${TRAVIS_OS_NAME:-}" == "" ]; then
TRAVIS_OS_NAME=windows TRAVIS_OS_NAME=windows
elif uname -s | grep -i MINGW &> /dev/null; then elif uname -s | grep -i MINGW &> /dev/null; then
TRAVIS_OS_NAME=windows TRAVIS_OS_NAME=windows
elif [ "${APPVEYOR:-}" == "True" ]; then
TRAVIS_OS_NAME=windows
else else
echo "Failed to guess OS"; exit 1 echo "Failed to guess OS"; exit 1
fi fi