Skip to content

Commit 9a1a535

Browse files
Sungsoo Limandi34
authored andcommitted
Fix possible out of bounds accesses
Bug: 30074856 Change-Id: I1a1387ed29d2e0d010b0d5d4bb3d29453a3a7666 (cherry picked from commit ee54e6ceb66e16b3c10c4a9fc8fbe5fff9110b62) (cherry picked from commit 78cc5b2401047d8c8ca77f633d8fa32c94e8e8f5)
1 parent 96777bd commit 9a1a535

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

gpsinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ void ProcessGpsInfo(unsigned char * DirStart, int ByteCountUnused, unsigned char
174174
unsigned OffsetVal;
175175
OffsetVal = Get32u(DirEntry+8);
176176
// If its bigger than 4 bytes, the dir entry contains an offset.
177-
if (OffsetVal+ByteCount > ExifLength){
177+
if (OffsetVal > UINT32_MAX - ByteCount || OffsetVal+ByteCount > ExifLength){
178178
// Bogus pointer offset and / or bytecount value
179179
ErrNonfatal("Illegal value pointer for tag %04x", Tag,0);
180180
continue;

makernote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void ProcessCanonMakerNoteDir(unsigned char * DirStart, unsigned char * OffsetBa
6262
unsigned OffsetVal;
6363
OffsetVal = Get32u(DirEntry+8);
6464
// If its bigger than 4 bytes, the dir entry contains an offset.
65-
if (OffsetVal+ByteCount > ExifLength){
65+
if (OffsetVal > UINT32_MAX - ByteCount || OffsetVal+ByteCount > ExifLength){
6666
// Bogus pointer offset and / or bytecount value
6767
ErrNonfatal("Illegal value pointer for tag %04x", Tag,0);
6868
continue;

0 commit comments

Comments
 (0)