diff options
author | erouault <erouault> | 2017-05-29 10:12:54 +0000 |
---|---|---|
committer | erouault <erouault> | 2017-05-29 10:12:54 +0000 |
commit | 73b118012426a9d553ba05ade114599bfb039fa2 (patch) | |
tree | a02689c3930a145256aeb1c615c77f1d7a266de2 | |
parent | 9955d92e7483ef8a3a8a3a7b5f216800611fae93 (diff) | |
download | libtiff-73b118012426a9d553ba05ade114599bfb039fa2.tar.gz |
* libtiff/tif_color.c: TIFFYCbCrToRGBInit(): stricter clamping to avoid
int32 overflow in TIFFYCbCrtoRGB().
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1844
Credit to OSS Fuzz
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | libtiff/tif_color.c | 8 |
2 files changed, 11 insertions, 4 deletions
@@ -1,3 +1,10 @@ +2017-05-20 Even Rouault <even.rouault at spatialys.com> + + * libtiff/tif_color.c: TIFFYCbCrToRGBInit(): stricter clamping to avoid + int32 overflow in TIFFYCbCrtoRGB(). + Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=1844 + Credit to OSS Fuzz + 2017-05-21 Bob Friesenhahn <bfriesen@simple.dallas.tx.us> * configure.ac: libtiff 4.0.8 released. diff --git a/libtiff/tif_color.c b/libtiff/tif_color.c index 8b8418c3..71cafcde 100644 --- a/libtiff/tif_color.c +++ b/libtiff/tif_color.c @@ -1,4 +1,4 @@ -/* $Id: tif_color.c,v 1.23 2017-05-13 18:17:34 erouault Exp $ */ +/* $Id: tif_color.c,v 1.24 2017-05-29 10:12:54 erouault Exp $ */ /* * Copyright (c) 1988-1997 Sam Leffler @@ -275,10 +275,10 @@ TIFFYCbCrToRGBInit(TIFFYCbCrToRGB* ycbcr, float *luma, float *refBlackWhite) for (i = 0, x = -128; i < 256; i++, x++) { int32 Cr = (int32)CLAMPw(Code2V(x, refBlackWhite[4] - 128.0F, refBlackWhite[5] - 128.0F, 127), - -128.0F * 64, 128.0F * 64); + -128.0F * 32, 128.0F * 32); int32 Cb = (int32)CLAMPw(Code2V(x, refBlackWhite[2] - 128.0F, refBlackWhite[3] - 128.0F, 127), - -128.0F * 64, 128.0F * 64); + -128.0F * 32, 128.0F * 32); ycbcr->Cr_r_tab[i] = (int32)((D1*Cr + ONE_HALF)>>SHIFT); ycbcr->Cb_b_tab[i] = (int32)((D3*Cb + ONE_HALF)>>SHIFT); @@ -286,7 +286,7 @@ TIFFYCbCrToRGBInit(TIFFYCbCrToRGB* ycbcr, float *luma, float *refBlackWhite) ycbcr->Cb_g_tab[i] = D4*Cb + ONE_HALF; ycbcr->Y_tab[i] = (int32)CLAMPw(Code2V(x + 128, refBlackWhite[0], refBlackWhite[1], 255), - -128.0F * 64, 128.0F * 64); + -128.0F * 32, 128.0F * 32); } } |