mirror of
https://github.com/openharmony/third_party_libexif.git
synced 2026-07-21 00:26:31 -04:00
add boundary checks for RATIONAL and SRATIONAL generic output (oss-fuzz)
This commit is contained in:
@@ -132,12 +132,16 @@ mnote_apple_entry_get_value(MnoteAppleEntry *entry, char *v, unsigned int maxlen
|
||||
}
|
||||
break;
|
||||
case EXIF_FORMAT_RATIONAL:
|
||||
if (size < exif_format_get_size (EXIF_FORMAT_RATIONAL)) return NULL;
|
||||
if (entry->components < 1) return NULL; /* FIXME: could handle more than 1 too */
|
||||
vr = exif_get_rational (data, entry->order);
|
||||
if (!vr.denominator) break;
|
||||
snprintf (v, maxlen, "%2.4f", (double) vr.numerator /
|
||||
vr.denominator);
|
||||
break;
|
||||
case EXIF_FORMAT_SRATIONAL:
|
||||
if (size < exif_format_get_size (EXIF_FORMAT_SRATIONAL)) return NULL;
|
||||
if (entry->components < 1) return NULL; /* FIXME: could handle more than 1 too */
|
||||
vsr = exif_get_srational (data, entry->order);
|
||||
if (!vsr.denominator) break;
|
||||
snprintf (v, maxlen, "%2.4f", (double) vsr.numerator /
|
||||
|
||||
Reference in New Issue
Block a user