media-libs/tiff: update pdfium patches to be more portable

Put helper funcs in the private headers, and stick to older C standards.
This commit is contained in:
Mike Frysinger
2017-04-12 15:13:34 -04:00
parent 484e623c7c
commit f383efc413
3 changed files with 14 additions and 14 deletions

View 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

View 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;