summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--third_party/libtiff/0014-cast-to-unsigned-in-putagreytile.patch13
-rw-r--r--third_party/libtiff/README.pdfium1
-rw-r--r--third_party/libtiff/tif_getimage.c2
3 files changed, 15 insertions, 1 deletions
diff --git a/third_party/libtiff/0014-cast-to-unsigned-in-putagreytile.patch b/third_party/libtiff/0014-cast-to-unsigned-in-putagreytile.patch
new file mode 100644
index 0000000000..00336b188c
--- /dev/null
+++ b/third_party/libtiff/0014-cast-to-unsigned-in-putagreytile.patch
@@ -0,0 +1,13 @@
+diff --git a/third_party/libtiff/tif_getimage.c b/third_party/libtiff/tif_getimage.c
+index 1cf6ac6b4..2861cdd1e 100644
+--- a/third_party/libtiff/tif_getimage.c
++++ b/third_party/libtiff/tif_getimage.c
+@@ -1281,7 +1281,7 @@ DECLAREContigPutFunc(putagreytile)
+ while (h-- > 0) {
+ for (x = w; x-- > 0;)
+ {
+- *cp++ = BWmap[*pp][0] & (*(pp+1) << 24 | ~A1);
++ *cp++ = BWmap[*pp][0] & ((uint32)*(pp+1) << 24 | ~A1);
+ pp += samplesperpixel;
+ }
+ cp += toskew;
diff --git a/third_party/libtiff/README.pdfium b/third_party/libtiff/README.pdfium
index 9acd4c7f63..58bb63e40e 100644
--- a/third_party/libtiff/README.pdfium
+++ b/third_party/libtiff/README.pdfium
@@ -23,3 +23,4 @@ Local Modifications:
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
0013-validate-refblackwhite.patch: Make sure the refblackwhite values aren't nan.
+0014-cast-to-unsigned-in-putagreytile.patch: casting to avoid undefined shifts. \ No newline at end of file
diff --git a/third_party/libtiff/tif_getimage.c b/third_party/libtiff/tif_getimage.c
index 1cf6ac6b45..2861cdd1e2 100644
--- a/third_party/libtiff/tif_getimage.c
+++ b/third_party/libtiff/tif_getimage.c
@@ -1281,7 +1281,7 @@ DECLAREContigPutFunc(putagreytile)
while (h-- > 0) {
for (x = w; x-- > 0;)
{
- *cp++ = BWmap[*pp][0] & (*(pp+1) << 24 | ~A1);
+ *cp++ = BWmap[*pp][0] & ((uint32)*(pp+1) << 24 | ~A1);
pp += samplesperpixel;
}
cp += toskew;