aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/tiff.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-11-17 23:18:01 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2022-11-28 21:20:56 +0100
commitff2d1bbe737539b9f564e53f84b7309bc2a38243 (patch)
tree017a125620cb2e3d45f4d8a6e3ecc3712872a222 /libavcodec/tiff.c
parentb2c1a0fc2b196d4cdbaae5b120229138857b559f (diff)
downloadffmpeg-ff2d1bbe737539b9f564e53f84b7309bc2a38243.tar.gz
avcodec/tiff: Avoid 0.0/0.0 in camera_xyz_coeff()
Fixes: division by zero Fixes: 52230/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TIFF_fuzzer-5922608915021824 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/tiff.c')
-rw-r--r--libavcodec/tiff.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 5b56892071..cde318d5e5 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1896,6 +1896,8 @@ static void camera_xyz_coeff(TiffContext *s,
for (i = 0; i < 3; i++) {
for (num = j = 0; j < 3; j++)
num += cam2rgb[i][j];
+ if (!num)
+ num = 1;
for (j = 0; j < 3; j++)
cam2rgb[i][j] /= num;
s->premultiply[i] = 1.f / num;