aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graphics/openexr/Makefile7
-rw-r--r--graphics/openexr/files/patch-549a0835deb46
-rw-r--r--graphics/openexr/files/patch-61d209bfd8d35
3 files changed, 86 insertions, 2 deletions
diff --git a/graphics/openexr/Makefile b/graphics/openexr/Makefile
index 4154da66974b..0114528d230d 100644
--- a/graphics/openexr/Makefile
+++ b/graphics/openexr/Makefile
@@ -2,6 +2,7 @@
PORTNAME= openexr
PORTVERSION= 3.0.1
+PORTREVISION= 1
CATEGORIES= graphics devel
MASTER_SITES= LOCAL/mandree/:test
DISTFILES= ${PORTNAME}-2.2.0-comp_dwa-test-images.tar.xz:test
@@ -25,12 +26,14 @@ CPPFLAGS+= -I. -I../IlmImf
# must be linked with -l{thr|pthread} explicitly
LDFLAGS+= -lpthread
-MAJORVER= 3_0
+PATCH_STRIP= -p1
+
+_MAJORVER= 3_0
_VER= 27
_MINVER= 0
_PLVER= 0
-PLIST_SUB+= MAJORVER=${MAJORVER} \
+PLIST_SUB+= MAJORVER=${_MAJORVER} \
VER=${_VER} \
MINVER=${_MINVER} \
PLVER=${_PLVER}
diff --git a/graphics/openexr/files/patch-549a0835deb b/graphics/openexr/files/patch-549a0835deb
new file mode 100644
index 000000000000..bc34fdaf3bfe
--- /dev/null
+++ b/graphics/openexr/files/patch-549a0835deb
@@ -0,0 +1,46 @@
+From 549a0835deb257f5caf5e54880c2be968e690b83 Mon Sep 17 00:00:00 2001
+From: Larry Gritz <lg@larrygritz.com>
+Date: Thu, 8 Apr 2021 15:33:40 -0700
+Subject: [PATCH] Don't impose C++14 on downstream projects (#995)
+
+We were setting
+
+ target_compile_features(${objlib} PUBLIC cxx_std_${OPENEXR_CXX_STANDARD})
+
+The `PUBLIC` forced downstream projects that consume the
+`OpenEXRConfig*.cmake` exports to use C++ standard at least as recent
+as what OpenEXR used to build (which defaults to 14).
+
+But this is unnecessary. There's nothing in OpenEXR's headers that
+requires anything beyond C++11. So this patch uses a more fine-grained
+setting of target properties to express this more correctly. Now it will
+be fine for a C++11 project to consume OpenEXR (via its exported configs)
+even if that OpenEXR happened to be built with C++14.
+
+Signed-off-by: Larry Gritz <lg@larrygritz.com>
+---
+ cmake/LibraryDefine.cmake | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/cmake/LibraryDefine.cmake b/cmake/LibraryDefine.cmake
+index 640974291..7ed74da9d 100644
+--- a/cmake/LibraryDefine.cmake
++++ b/cmake/LibraryDefine.cmake
+@@ -17,7 +17,16 @@ function(OPENEXR_DEFINE_LIBRARY libname)
+ ${OPENEXR_CURLIB_HEADERS}
+ ${OPENEXR_CURLIB_SOURCES})
+
+- target_compile_features(${objlib} PUBLIC cxx_std_${OPENEXR_CXX_STANDARD})
++ # Use ${OPENEXR_CXX_STANDARD} to determine the standard we use to compile
++ # OpenEXR itself. But the headers only require C++11 features, so that's
++ # all we need to pass on as interface reqirements to downstream projects.
++ # For example, it's fine for an OpenEXR built with C++14 to be called from
++ # an app that is compiled with C++11; OpenEXR needn't force the app to
++ # also use C++14.
++ target_compile_features(${objlib}
++ PRIVATE cxx_std_${OPENEXR_CXX_STANDARD}
++ INTERFACE cxx_std_11 )
++
+ if(OPENEXR_CURLIB_PRIV_EXPORT AND BUILD_SHARED_LIBS)
+ target_compile_definitions(${objlib} PRIVATE ${OPENEXR_CURLIB_PRIV_EXPORT})
+ if(WIN32)
diff --git a/graphics/openexr/files/patch-61d209bfd8d b/graphics/openexr/files/patch-61d209bfd8d
new file mode 100644
index 000000000000..6800a1ce3c56
--- /dev/null
+++ b/graphics/openexr/files/patch-61d209bfd8d
@@ -0,0 +1,35 @@
+From 61d209bfd8daefc758735cd20ccff977f98b49a0 Mon Sep 17 00:00:00 2001
+From: peterhillman <peterh@wetafx.co.nz>
+Date: Sat, 8 May 2021 12:02:38 +1200
+Subject: [PATCH] Prevent overflow in getScanlineChunkOffsetTableSize (#1003)
+
+Signed-off-by: Peter Hillman <peterh@wetafx.co.nz>
+---
+ src/lib/OpenEXR/ImfMisc.cpp | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/src/lib/OpenEXR/ImfMisc.cpp b/src/lib/OpenEXR/ImfMisc.cpp
+index a65e2a3f4..80c8ce8d2 100644
+--- a/src/lib/OpenEXR/ImfMisc.cpp
++++ b/src/lib/OpenEXR/ImfMisc.cpp
+@@ -1828,12 +1828,17 @@ getScanlineChunkOffsetTableSize(const Header& header)
+ {
+ const Box2i &dataWindow = header.dataWindow();
+
+- int linesInBuffer = numLinesInBuffer ( header.compression() );
+
+- int lineOffsetSize = (dataWindow.max.y - dataWindow.min.y +
++ //
++ // use int64_t types to prevent overflow in lineOffsetSize for images with
++ // extremely high dataWindows
++ //
++ int64_t linesInBuffer = numLinesInBuffer ( header.compression() );
++
++ int64_t lineOffsetSize = (static_cast <int64_t>(dataWindow.max.y) - static_cast <int64_t>(dataWindow.min.y) +
+ linesInBuffer) / linesInBuffer;
+
+- return lineOffsetSize;
++ return static_cast <int>(lineOffsetSize);
+ }
+
+ //