mirror of
https://github.com/opencv/opencv.git
synced 2025-07-25 22:57:53 +08:00
Update exif.cpp
ExifReader::getExif may enter infinite loop with jpeg image which have no EOI. For example, bytesToSkip may be set to 0 and fseek seems like fseek(f, -2 , SEEK_CUR) for image that end with RST7(FF D7) instead of EOI.
This commit is contained in:
parent
4fd00c1ae1
commit
e69253a4fb
@ -160,6 +160,10 @@ std::map<int, ExifEntry_t > ExifReader::getExif()
|
|||||||
case APP9: case APP10: case APP11: case APP12: case APP13: case APP14: case APP15:
|
case APP9: case APP10: case APP11: case APP12: case APP13: case APP14: case APP15:
|
||||||
case COM:
|
case COM:
|
||||||
bytesToSkip = getFieldSize( f );
|
bytesToSkip = getFieldSize( f );
|
||||||
|
if (bytesToSkip < markerSize) {
|
||||||
|
fclose(f);
|
||||||
|
throw ExifParsingError();
|
||||||
|
}
|
||||||
fseek( f, static_cast<long>( bytesToSkip - markerSize ), SEEK_CUR );
|
fseek( f, static_cast<long>( bytesToSkip - markerSize ), SEEK_CUR );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user