diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-01-04 13:27:51 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-01-05 21:58:25 +0000 |
commit | c4fcad23b1438aa6ad19f518503f861b9e3815e1 (patch) | |
tree | e76a65ac310329434ba8a0b5cd4fcc7d30a1352e /third_party | |
parent | 647f28460b903986ebddb95759214080e1dc7993 (diff) | |
download | pdfium-c4fcad23b1438aa6ad19f518503f861b9e3815e1.tar.xz |
[libtiff] Fixup unitialized access issue
This CL initializes the raw tif data to guard against unitialized memory access.
BUG=chromium:677377
Change-Id: If272fafacd996c2e93a41fb6e477661dc0c5492c
Reviewed-on: https://pdfium-review.googlesource.com/2150
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/libtiff/0012-initialize-tif-rawdata.patch | 14 | ||||
-rw-r--r-- | third_party/libtiff/README.pdfium | 1 | ||||
-rw-r--r-- | third_party/libtiff/tif_read.c | 3 |
3 files changed, 18 insertions, 0 deletions
diff --git a/third_party/libtiff/0012-initialize-tif-rawdata.patch b/third_party/libtiff/0012-initialize-tif-rawdata.patch new file mode 100644 index 0000000000..2543b89eb0 --- /dev/null +++ b/third_party/libtiff/0012-initialize-tif-rawdata.patch @@ -0,0 +1,14 @@ +diff --git a/third_party/libtiff/tif_read.c b/third_party/libtiff/tif_read.c +index 5cb419bd4..548b1f5ea 100644 +--- a/third_party/libtiff/tif_read.c ++++ b/third_party/libtiff/tif_read.c +@@ -936,6 +936,9 @@ TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size) + return (0); + } + tif->tif_rawdata = (uint8*) _TIFFmalloc(tif->tif_rawdatasize); ++ if (tif->tif_rawdata) ++ memset(tif->tif_rawdata, 0, tif->tif_rawdatasize); ++ + tif->tif_flags |= TIFF_MYBUFFER; + } + if (tif->tif_rawdata == NULL) { diff --git a/third_party/libtiff/README.pdfium b/third_party/libtiff/README.pdfium index fde3060c9a..c55fc63f36 100644 --- a/third_party/libtiff/README.pdfium +++ b/third_party/libtiff/README.pdfium @@ -21,3 +21,4 @@ Local Modifications: 0009-HeapBufferOverflow-PixarLogDecode.patch: Fix a heap buffer overflow 0010-fix-leak-imagebegin: Fix a leak when TIFFRGBAImageBegin fails 0011-fix-leak-imagebegin2: Apply upstream fix related to our previous patch +0012-initialize-tif-rawdata.patch: Initialize tif_rawdata to guard against unitialized access diff --git a/third_party/libtiff/tif_read.c b/third_party/libtiff/tif_read.c index 5cb419bd41..548b1f5ea6 100644 --- a/third_party/libtiff/tif_read.c +++ b/third_party/libtiff/tif_read.c @@ -936,6 +936,9 @@ TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size) return (0); } tif->tif_rawdata = (uint8*) _TIFFmalloc(tif->tif_rawdatasize); + if (tif->tif_rawdata) + memset(tif->tif_rawdata, 0, tif->tif_rawdatasize); + tif->tif_flags |= TIFF_MYBUFFER; } if (tif->tif_rawdata == NULL) { |