Merge pull request #1239 from Exiv2/fix_1236_0.27

fix_1236_0.27
main
Robin Mills 5 years ago committed by GitHub
commit 489c128c30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -678,20 +678,20 @@ static void boxes_check(size_t b,size_t m)
if ( ! iccProfileDefined() ) { if ( ! iccProfileDefined() ) {
const char* pad = "\x01\x00\x00\x00\x00\x00\x10\x00\x00\x05\x1cuuid"; const char* pad = "\x01\x00\x00\x00\x00\x00\x10\x00\x00\x05\x1cuuid";
uint32_t psize = 15; uint32_t psize = 15;
newlen = sizeof(newBox) + psize ;
ul2Data((byte*)&newBox.length,psize ,bigEndian); ul2Data((byte*)&newBox.length,psize ,bigEndian);
ul2Data((byte*)&newBox.type ,newBox.type,bigEndian); ul2Data((byte*)&newBox.type ,newBox.type,bigEndian);
::memcpy(output.pData_+outlen ,&newBox ,sizeof(newBox)); ::memcpy(output.pData_+outlen ,&newBox ,sizeof(newBox));
::memcpy(output.pData_+outlen+sizeof(newBox) ,pad ,psize ); ::memcpy(output.pData_+outlen+sizeof(newBox) ,pad ,psize );
newlen = psize ;
} else { } else {
const char* pad = "\0x02\x00\x00"; const char* pad = "\x02\x00\x00";
uint32_t psize = 3; 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); ul2Data((byte*)&newBox.type,newBox.type,bigEndian);
::memcpy(output.pData_+outlen ,&newBox ,sizeof(newBox) ); ::memcpy(output.pData_+outlen ,&newBox ,sizeof(newBox) );
::memcpy(output.pData_+outlen+sizeof(newBox) , pad ,psize ); ::memcpy(output.pData_+outlen+sizeof(newBox) , pad ,psize );
::memcpy(output.pData_+outlen+sizeof(newBox)+psize,iccProfile_.pData_,iccProfile_.size_); ::memcpy(output.pData_+outlen+sizeof(newBox)+psize,iccProfile_.pData_,iccProfile_.size_);
newlen = psize + iccProfile_.size_;
} }
} else { } else {
::memcpy(output.pData_+outlen,boxBuf.pData_+inlen,subBox.length); ::memcpy(output.pData_+outlen,boxBuf.pData_+inlen,subBox.length);

@ -729,3 +729,33 @@ STRUCTURE OF JPEG FILE: ReaganLargeJpg.jpg
50b9125494306a6fc1b7c4f2a1a8d49d 50b9125494306a6fc1b7c4f2a1a8d49d
45ed3c125cc6041b37b44ee4cb881cd8 45ed3c125cc6041b37b44ee4cb881cd8
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

@ -5,18 +5,20 @@ source ./functions.source
test1120() # --comment and -dc clobbered by writing ICC/JPG test1120() # --comment and -dc clobbered by writing ICC/JPG
{ {
runTest exiv2 --comment abcdefg $filename if [ "$filename" != "Reagan2.jp2" ]; then
runTest exiv2 -pS $filename runTest exiv2 --comment abcdefg $filename
runTest exiv2 -pc $filename runTest exiv2 -pS $filename
runTest exiv2 -dc $filename runTest exiv2 -pc $filename
runTest exiv2 -pS $filename runTest exiv2 -dc $filename
runTest exiv2 -pS $filename
fi
} }
( cd "$testdir" ( cd "$testdir"
num=1074 # ICC Profile Support num=1074 # ICC Profile Support
printf "ICC " >&3 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 do
format=$(echo $filename|cut -d. -f 2) format=$(echo $filename|cut -d. -f 2)
stub=$( echo $filename|cut -d. -f 1) stub=$( echo $filename|cut -d. -f 1)

Loading…
Cancel
Save