media-libs/tiff: update pdfium patches to be more portable
authorMike Frysinger <vapier@gentoo.org>
Wed, 12 Apr 2017 19:13:34 +0000 (15:13 -0400)
committerMike Frysinger <vapier@gentoo.org>
Wed, 12 Apr 2017 19:25:37 +0000 (15:25 -0400)
Put helper funcs in the private headers, and stick to older C standards.

media-libs/tiff/files/tiff-4.0.7-pdfium-0006-HeapBufferOverflow-ChopUpSingleUncompressedStrip.patch
media-libs/tiff/files/tiff-4.0.7-pdfium-0013-validate-refblackwhite.patch
media-libs/tiff/tiff-4.0.7-r3.ebuild [moved from media-libs/tiff/tiff-4.0.7-r2.ebuild with 100% similarity]

index f573fd9deb33daa07cd10fb9d648f9670d795f1c..a45ee342f779967a171a41265d1f2e71897329aa 100644 (file)
@@ -19,16 +19,15 @@ overflow.
                cp = _TIFFrealloc(buffer, bytes);
  
        if (cp == NULL) {
---- a/libtiff/tiffio.h
-+++ b/libtiff/tiffio.h
-@@ -298,6 +298,10 @@ extern void _TIFFmemset(void* p, int v, tmsize_t c);
- extern void _TIFFmemcpy(void* d, const void* s, tmsize_t c);
- extern int _TIFFmemcmp(const void* p1, const void* p2, tmsize_t c);
- extern void _TIFFfree(void* p);
-+#include <limits.h>
-+static inline int _TIFFIfMultiplicationOverflow(tmsize_t op1, tmsize_t op2) {
-+  return op1 > SSIZE_MAX / op2;
-+}
+--- a/libtiff/tiffiop.h
++++ b/libtiff/tiffiop.h
+@@ -315,6 +315,9 @@ typedef size_t TIFFIOSize_t;
+ #define _TIFF_off_t off_t
+ #endif
  
- /*
- ** Stuff, related to tag handling and creating custom tags.
++#include <limits.h>
++#define _TIFFIfMultiplicationOverflow(op1, op2) ((op1) > SSIZE_MAX / (op2))
++
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
index 47a3db06431a292546bc01c7f29def369ec83b5c..d98ff9d0f252a77da3952ffdb9d76ce27817866b 100644 (file)
@@ -24,11 +24,12 @@ them to the default provided by the TIFF spec v6.
  #include <float.h>
  
  /*
-@@ -426,6 +426,14 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
+@@ -426,6 +426,15 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
        case TIFFTAG_REFERENCEBLACKWHITE:
                /* XXX should check for null range */
                _TIFFsetFloatArray(&td->td_refblackwhite, va_arg(ap, float*), 6);
-+              for (int i = 0; i < 6; i++) {
++              int i;
++              for (i = 0; i < 6; i++) {
 +                      if (isnan(td->td_refblackwhite[i])) {
 +                              if (i % 2 == 0)
 +                                      td->td_refblackwhite[i] = 0;