summaryrefslogtreecommitdiff
path: root/ext/exif/exif.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-10-09 17:33:52 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-10-09 17:33:52 +0200
commit5b44560dfcd70d4bc7f48328b8a3bb72e1442b56 (patch)
treed487d914932b1a613910981eda1b67760a9b63c2 /ext/exif/exif.c
parent973617cacd9a289ebc71de7bf205d9bad0ca150c (diff)
parenta0163417efd8d86324e5b58d7d826840e8ab0d54 (diff)
downloadphp-git-5b44560dfcd70d4bc7f48328b8a3bb72e1442b56.tar.gz
Merge branch 'PHP-7.3' into PHP-7.4
Diffstat (limited to 'ext/exif/exif.c')
-rw-r--r--ext/exif/exif.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index 2639bd330c..88230a8296 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -4515,8 +4515,9 @@ PHP_FUNCTION(exif_read_data)
exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "CCDWidth", "%dmm", (int)ImageInfo.CCDWidth);
}
if(ImageInfo.ExposureTime>0) {
- if(ImageInfo.ExposureTime <= 0.5) {
- exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime", "%0.3F s (1/%d)", ImageInfo.ExposureTime, (int)(0.5 + 1/ImageInfo.ExposureTime));
+ float recip_exposure_time = 0.5f + 1.0f/ImageInfo.ExposureTime;
+ if (ImageInfo.ExposureTime <= 0.5 && recip_exposure_time < INT_MAX) {
+ exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime", "%0.3F s (1/%d)", ImageInfo.ExposureTime, (int) recip_exposure_time);
} else {
exif_iif_add_fmt(&ImageInfo, SECTION_COMPUTED, "ExposureTime", "%0.3F s", ImageInfo.ExposureTime);
}