diff options
author | Lei Zhang <thestig@chromium.org> | 2017-03-20 15:46:06 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-21 13:12:16 +0000 |
commit | cfb6f46473777e444c8124318aa78d33aae64459 (patch) | |
tree | 272d17a7ba02251fd6d62a90c431e5af169af85a /third_party/libtiff/tif_aux.c | |
parent | 34a28b470a9a4d7c7edd04e9b6a1e02a7490e58b (diff) | |
download | pdfium-cfb6f46473777e444c8124318aa78d33aae64459.tar.xz |
Upgrade libtiff to 4.0.7.
Change-Id: If3f67767f738b7f23230ca8c37c9af2e31696e82
Reviewed-on: https://pdfium-review.googlesource.com/3117
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'third_party/libtiff/tif_aux.c')
-rw-r--r-- | third_party/libtiff/tif_aux.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/third_party/libtiff/tif_aux.c b/third_party/libtiff/tif_aux.c index bc4ea01928..74532c8c6f 100644 --- a/third_party/libtiff/tif_aux.c +++ b/third_party/libtiff/tif_aux.c @@ -1,4 +1,4 @@ -/* $Id: tif_aux.c,v 1.26 2010-07-01 15:33:28 dron Exp $ */ +/* $Id: tif_aux.c,v 1.29 2016-11-11 20:45:53 erouault Exp $ */ /* * Copyright (c) 1991-1997 Sam Leffler @@ -100,7 +100,8 @@ TIFFDefaultTransferFunction(TIFFDirectory* td) n = ((tmsize_t)1)<<td->td_bitspersample; nbytes = n * sizeof (uint16); - if (!(tf[0] = (uint16 *)_TIFFmalloc(nbytes))) + tf[0] = (uint16 *)_TIFFmalloc(nbytes); + if (tf[0] == NULL) return 0; tf[0][0] = 0; for (i = 1; i < n; i++) { @@ -109,10 +110,12 @@ TIFFDefaultTransferFunction(TIFFDirectory* td) } if (td->td_samplesperpixel - td->td_extrasamples > 1) { - if (!(tf[1] = (uint16 *)_TIFFmalloc(nbytes))) + tf[1] = (uint16 *)_TIFFmalloc(nbytes); + if(tf[1] == NULL) goto bad; _TIFFmemcpy(tf[1], tf[0], nbytes); - if (!(tf[2] = (uint16 *)_TIFFmalloc(nbytes))) + tf[2] = (uint16 *)_TIFFmalloc(nbytes); + if (tf[2] == NULL) goto bad; _TIFFmemcpy(tf[2], tf[0], nbytes); } @@ -134,7 +137,8 @@ TIFFDefaultRefBlackWhite(TIFFDirectory* td) { int i; - if (!(td->td_refblackwhite = (float *)_TIFFmalloc(6*sizeof (float)))) + td->td_refblackwhite = (float *)_TIFFmalloc(6*sizeof (float)); + if (td->td_refblackwhite == NULL) return 0; if (td->td_photometric == PHOTOMETRIC_YCBCR) { /* @@ -163,7 +167,7 @@ TIFFDefaultRefBlackWhite(TIFFDirectory* td) * value if the tag is not present in the directory. * * NB: We use the value in the directory, rather than - * explcit values so that defaults exist only one + * explicit values so that defaults exist only one * place in the library -- in TIFFDefaultDirectory. */ int @@ -208,11 +212,18 @@ TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap) *va_arg(ap, uint16 *) = td->td_resolutionunit; return (1); case TIFFTAG_PREDICTOR: - { - TIFFPredictorState* sp = (TIFFPredictorState*) tif->tif_data; - *va_arg(ap, uint16*) = (uint16) sp->predictor; - return 1; - } + { + TIFFPredictorState* sp = (TIFFPredictorState*) tif->tif_data; + if( sp == NULL ) + { + TIFFErrorExt(tif->tif_clientdata, tif->tif_name, + "Cannot get \"Predictor\" tag as plugin is not configured"); + *va_arg(ap, uint16*) = 0; + return 0; + } + *va_arg(ap, uint16*) = (uint16) sp->predictor; + return 1; + } case TIFFTAG_DOTRANGE: *va_arg(ap, uint16 *) = 0; *va_arg(ap, uint16 *) = (1<<td->td_bitspersample)-1; |