diff --git a/src/jp2image.cpp b/src/jp2image.cpp index 0de088d6..e6dae63b 100644 --- a/src/jp2image.cpp +++ b/src/jp2image.cpp @@ -678,20 +678,20 @@ static void boxes_check(size_t b,size_t m) if ( ! iccProfileDefined() ) { const char* pad = "\x01\x00\x00\x00\x00\x00\x10\x00\x00\x05\x1cuuid"; uint32_t psize = 15; + newlen = sizeof(newBox) + psize ; ul2Data((byte*)&newBox.length,psize ,bigEndian); ul2Data((byte*)&newBox.type ,newBox.type,bigEndian); ::memcpy(output.pData_+outlen ,&newBox ,sizeof(newBox)); ::memcpy(output.pData_+outlen+sizeof(newBox) ,pad ,psize ); - newlen = psize ; } else { - const char* pad = "\0x02\x00\x00"; + const char* pad = "\x02\x00\x00"; uint32_t psize = 3; - ul2Data((byte*)&newBox.length,psize+iccProfile_.size_,bigEndian); + newlen = sizeof(newBox) + psize + iccProfile_.size_; + ul2Data((byte*)&newBox.length,newlen,bigEndian); ul2Data((byte*)&newBox.type,newBox.type,bigEndian); ::memcpy(output.pData_+outlen ,&newBox ,sizeof(newBox) ); ::memcpy(output.pData_+outlen+sizeof(newBox) , pad ,psize ); ::memcpy(output.pData_+outlen+sizeof(newBox)+psize,iccProfile_.pData_,iccProfile_.size_); - newlen = psize + iccProfile_.size_; } } else { ::memcpy(output.pData_+outlen,boxBuf.pData_+inlen,subBox.length); diff --git a/test/data/icc-test.out b/test/data/icc-test.out index 54b9c2e9..b495b2f3 100644 --- a/test/data/icc-test.out +++ b/test/data/icc-test.out @@ -729,3 +729,33 @@ STRUCTURE OF JPEG FILE: ReaganLargeJpg.jpg 50b9125494306a6fc1b7c4f2a1a8d49d 45ed3c125cc6041b37b44ee4cb881cd8 45ed3c125cc6041b37b44ee4cb881cd8 +STRUCTURE OF JPEG2000 FILE: Reagan2.jp2 + address | length | box | data + 0 | 12 | jP | + 12 | 20 | ftyp | + 32 | 3185 | jp2h | + 40 | 22 | sub:ihdr | ............. + 62 | 3155 | sub:colr | ......HLino....mntrRGB XYZ .. | pad: 2 0 0 | iccLength:3144 + 3217 | 0 | jp2c | +STRUCTURE OF JPEG2000 FILE: Reagan2.jp2 + address | length | box | data + 0 | 12 | jP | + 12 | 20 | ftyp | + 32 | 1613641 | jp2h | + 40 | 22 | sub:ihdr | ............. + 62 | 1613611 | sub:colr | ...... APPL....prtrRGB Lab .. | pad: 2 0 0 | iccLength:1613600 + 1613673 | 0 | jp2c | +STRUCTURE OF JPEG2000 FILE: Reagan2.jp2 + address | length | box | data + 0 | 12 | jP | + 12 | 20 | ftyp | + 32 | 601 | jp2h | + 40 | 22 | sub:ihdr | ............. + 62 | 571 | sub:colr | ......0ADBE....mntrRGB XYZ .. | pad: 2 0 0 | iccLength:560 + 633 | 0 | jp2c | +1d3fda2edb4a89ab60a23c5f7c7d81dd +1d3fda2edb4a89ab60a23c5f7c7d81dd +50b9125494306a6fc1b7c4f2a1a8d49d +50b9125494306a6fc1b7c4f2a1a8d49d +45ed3c125cc6041b37b44ee4cb881cd8 +45ed3c125cc6041b37b44ee4cb881cd8 diff --git a/test/icc-test.sh b/test/icc-test.sh index f2492127..45899b18 100755 --- a/test/icc-test.sh +++ b/test/icc-test.sh @@ -5,18 +5,20 @@ source ./functions.source test1120() # --comment and -dc clobbered by writing ICC/JPG { - runTest exiv2 --comment abcdefg $filename - runTest exiv2 -pS $filename - runTest exiv2 -pc $filename - runTest exiv2 -dc $filename - runTest exiv2 -pS $filename + if [ "$filename" != "Reagan2.jp2" ]; then + runTest exiv2 --comment abcdefg $filename + runTest exiv2 -pS $filename + runTest exiv2 -pc $filename + runTest exiv2 -dc $filename + runTest exiv2 -pS $filename + fi } ( cd "$testdir" num=1074 # ICC Profile Support printf "ICC " >&3 - for filename in Reagan.jpg exiv2-bug1199.webp ReaganLargePng.png ReaganLargeJpg.jpg # 1272 ReaganLargeTiff.tiff + for filename in Reagan.jpg exiv2-bug1199.webp ReaganLargePng.png ReaganLargeJpg.jpg Reagan2.jp2 # 1272 ReaganLargeTiff.tiff do format=$(echo $filename|cut -d. -f 2) stub=$( echo $filename|cut -d. -f 1)