summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSungsoo Lim <sungsoo@google.com>2016-07-20 16:59:05 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-07-20 16:59:05 +0000
commitde4cdf875849b4a451703adb546837e04af11416 (patch)
treee978abacd264d7d6a1a0d087427b7f82528722a4
parent854fedfa6b1cae1f37fe407f407ba833954b8fba (diff)
parentd98576d450a3efd13c30a1dd2459b9492af206c5 (diff)
downloadjhead-de4cdf875849b4a451703adb546837e04af11416.tar.gz
Fix possible out of bounds accesses am: ee54e6ceb6 am: 4c7c4297b5 am: 364ccf5071 am: fb76bf3245 am: 1a484d2270
am: d98576d450 Change-Id: I8026305f23527ec5e9d3f5719e8a192e8d5ec76f
-rw-r--r--gpsinfo.c2
-rw-r--r--makernote.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/gpsinfo.c b/gpsinfo.c
index cbf261e..0377300 100644
--- a/gpsinfo.c
+++ b/gpsinfo.c
@@ -174,7 +174,7 @@ void ProcessGpsInfo(unsigned char * DirStart, int ByteCountUnused, unsigned char
unsigned OffsetVal;
OffsetVal = Get32u(DirEntry+8);
// If its bigger than 4 bytes, the dir entry contains an offset.
- if (OffsetVal+ByteCount > ExifLength){
+ if (OffsetVal > UINT32_MAX - ByteCount || OffsetVal+ByteCount > ExifLength){
// Bogus pointer offset and / or bytecount value
ErrNonfatal("Illegal value pointer for tag %04x", Tag,0);
continue;
diff --git a/makernote.c b/makernote.c
index cf40c6b..514518d 100644
--- a/makernote.c
+++ b/makernote.c
@@ -62,7 +62,7 @@ void ProcessCanonMakerNoteDir(unsigned char * DirStart, unsigned char * OffsetBa
unsigned OffsetVal;
OffsetVal = Get32u(DirEntry+8);
// If its bigger than 4 bytes, the dir entry contains an offset.
- if (OffsetVal+ByteCount > ExifLength){
+ if (OffsetVal > UINT32_MAX - ByteCount || OffsetVal+ByteCount > ExifLength){
// Bogus pointer offset and / or bytecount value
ErrNonfatal("Illegal value pointer for tag %04x", Tag,0);
continue;