diff options
author | balmeras <bertrand.almeras@gmail.com> | 2015-05-19 19:34:36 +0200 |
---|---|---|
committer | balmeras <bertrand.almeras@gmail.com> | 2015-06-23 16:22:47 +0200 |
commit | 3b42ef03375396480bf3a8e942b39353e68ecda9 (patch) | |
tree | 26db20708c9d26a93fa122a9b10997309a982010 /lib | |
parent | 5c57ab98c5a220bb18864b22fb8b09fb0f1c72a4 (diff) |
[libexif] Ignore invalid DMS value in GPS coordinate, and fix kodi crash due to buffer overflow with special value FFFFFF
Diffstat (limited to 'lib')
-rwxr-xr-x[-rw-r--r--] | lib/libexif/ExifParse.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/libexif/ExifParse.cpp b/lib/libexif/ExifParse.cpp index 635d82f600..64bb815ced 100644..100755 --- a/lib/libexif/ExifParse.cpp +++ b/lib/libexif/ExifParse.cpp @@ -823,9 +823,18 @@ void CExifParse::GetLatLong( { Values[a] = ConvertAnyFormat(ValuePtr+a*ComponentSize, Format); } - char latLong[30]; - sprintf(latLong, "%3.0fd %2.0f' %5.2f\"", Values[0], Values[1], Values[2]); - strcat(latLongString, latLong); + if (Values[0] < 0 || Values[0] > 180 || Values[1] < 0 || Values[1] >= 60 || Values[2] < 0 || Values[2] >= 60) + { + // Ignore invalid values (DMS format expected) + ErrNonfatal("Invalid Lat/Long value", 0, 0); + latLongString[0] = 0; + } + else + { + char latLong[30]; + sprintf(latLong, "%3.0fd %2.0f' %5.2f\"", Values[0], Values[1], Values[2]); + strcat(latLongString, latLong); + } } } |