Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Dec 2019 12:16:18 +0000 (UTC)
From:      Matthias Andree <mandree@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r521275 - in head/graphics: ilmbase ilmbase/files openexr openexr/files
Message-ID:  <201912291216.xBTCGITb075473@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mandree
Date: Sun Dec 29 12:16:18 2019
New Revision: 521275
URL: https://svnweb.freebsd.org/changeset/ports/521275

Log:
  graphics/ilmbase,openexr: fix vulnerabilities
  
  Uses backported patches from upstream Git repository, without the
  exr2aces parts, and regenerates all openexr patches from scratch.
  
  MFH:		2019Q4 (blanket, security patches)
  Security:	e4d9dffb-2a32-11ea-9693-e1b3f6feec79
  Security:	CVE-2018-18443
  Security:	CVE-2018-18444

Added:
  head/graphics/ilmbase/files/patch-CVE-2018-18443   (contents, props changed)
  head/graphics/openexr/files/patch-IlmImfTest_main.cpp
     - copied, changed from r521274, head/graphics/openexr/files/patch-IlmImfTest__main.cpp
  head/graphics/openexr/files/patch-IlmImf_ImfFrameBuffer.cpp   (contents, props changed)
  head/graphics/openexr/files/patch-IlmImf_ImfFrameBuffer.h   (contents, props changed)
  head/graphics/openexr/files/patch-IlmImf_ImfHeader.cpp   (contents, props changed)
  head/graphics/openexr/files/patch-IlmImf_ImfRgbaFile.h   (contents, props changed)
  head/graphics/openexr/files/patch-IlmImf_ImfScanLineInputFile.cpp   (contents, props changed)
  head/graphics/openexr/files/patch-IlmImf_ImfSystemSpecific.cpp
     - copied, changed from r521274, head/graphics/openexr/files/patch-IlmImf__ImfSystemSpecific.cpp
  head/graphics/openexr/files/patch-exrenvmap_main.cpp
     - copied, changed from r521274, head/graphics/openexr/files/patch-exrenvmap__main.cpp
  head/graphics/openexr/files/patch-exrenvmap_readInputImage.cpp   (contents, props changed)
  head/graphics/openexr/files/patch-exrmakepreview_makePreview.cpp   (contents, props changed)
  head/graphics/openexr/files/patch-exrmaketiled_Image.h   (contents, props changed)
  head/graphics/openexr/files/patch-exrmaketiled_main.cpp
     - copied, changed from r521274, head/graphics/openexr/files/patch-exrmaketiled__main.cpp
  head/graphics/openexr/files/patch-exrmultiview_Image.h   (contents, props changed)
Deleted:
  head/graphics/openexr/files/patch-IlmImfTest__main.cpp
  head/graphics/openexr/files/patch-IlmImf__ImfSystemSpecific.cpp
  head/graphics/openexr/files/patch-exrenvmap__main.cpp
  head/graphics/openexr/files/patch-exrmaketiled__main.cpp
Modified:
  head/graphics/ilmbase/Makefile
  head/graphics/openexr/Makefile
  head/graphics/openexr/files/patch-IlmImfTest_testOptimizedInterleavePatterns.cpp
  head/graphics/openexr/files/patch-IlmImfUtilTest_main.cpp

Modified: head/graphics/ilmbase/Makefile
==============================================================================
--- head/graphics/ilmbase/Makefile	Sun Dec 29 12:11:09 2019	(r521274)
+++ head/graphics/ilmbase/Makefile	Sun Dec 29 12:16:18 2019	(r521275)
@@ -3,7 +3,7 @@
 
 PORTNAME=	ilmbase
 PORTVERSION=	2.3.0
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	graphics devel
 MASTER_SITES=	https://github.com/openexr/openexr/releases/download/v${PORTVERSION}/
 

Added: head/graphics/ilmbase/files/patch-CVE-2018-18443
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/ilmbase/files/patch-CVE-2018-18443	Sun Dec 29 12:16:18 2019	(r521275)
@@ -0,0 +1,30 @@
+From adbc1900cb9d25fcc4df008d4008b781cf2fa4f8 Mon Sep 17 00:00:00 2001
+From: Kimball Thurston <kdt3rd@gmail.com>
+Date: Thu, 27 Jun 2019 22:15:17 +1200
+Subject: [PATCH] Fix #350 - memory leak on exit
+
+This fixes CVE-2018-18443, the last thread pool provider set into the
+pool was not being correctly cleaned up at shutdown of the thread pool.
+
+Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
+---
+ CHANGES.md                          | 4 ++++ -- OMITTED/Matthias Andree
+ IlmBase/IlmThread/IlmThreadPool.cpp | 2 ++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/IlmBase/IlmThread/IlmThreadPool.cpp b/IlmBase/IlmThread/IlmThreadPool.cpp
+index 174ab98c..24ca7395 100644
+--- ./IlmThread/IlmThreadPool.cpp~
++++ ./IlmThread/IlmThreadPool.cpp
+@@ -566,9 +566,11 @@ ThreadPool::Data::~Data()
+ {
+ #ifdef ILMBASE_FORCE_CXX03
+     provider->finish();
++    delete provider;
+ #else
+     ThreadPoolProvider *p = provider.load( std::memory_order_relaxed );
+     p->finish();
++    delete p;
+ #endif
+ }
+ 

Modified: head/graphics/openexr/Makefile
==============================================================================
--- head/graphics/openexr/Makefile	Sun Dec 29 12:11:09 2019	(r521274)
+++ head/graphics/openexr/Makefile	Sun Dec 29 12:16:18 2019	(r521275)
@@ -3,7 +3,7 @@
 
 PORTNAME=	openexr
 PORTVERSION=	2.3.0
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	graphics devel
 MASTER_SITES=	https://github.com/${PORTNAME}/${PORTNAME}/releases/download/v${PORTVERSION}/:dist \
 		LOCAL/mandree/:test

Copied and modified: head/graphics/openexr/files/patch-IlmImfTest_main.cpp (from r521274, head/graphics/openexr/files/patch-IlmImfTest__main.cpp)
==============================================================================
--- head/graphics/openexr/files/patch-IlmImfTest__main.cpp	Sun Dec 29 12:11:09 2019	(r521274, copy source)
+++ head/graphics/openexr/files/patch-IlmImfTest_main.cpp	Sun Dec 29 12:16:18 2019	(r521275)
@@ -1,4 +1,4 @@
---- IlmImfTest/main.cpp.orig	2014-08-10 04:23:59 UTC
+--- IlmImfTest/main.cpp.orig	2018-08-10 01:34:59 UTC
 +++ IlmImfTest/main.cpp
 @@ -100,7 +100,7 @@
  #include <string.h>

Modified: head/graphics/openexr/files/patch-IlmImfTest_testOptimizedInterleavePatterns.cpp
==============================================================================
--- head/graphics/openexr/files/patch-IlmImfTest_testOptimizedInterleavePatterns.cpp	Sun Dec 29 12:11:09 2019	(r521274)
+++ head/graphics/openexr/files/patch-IlmImfTest_testOptimizedInterleavePatterns.cpp	Sun Dec 29 12:16:18 2019	(r521275)
@@ -1,4 +1,4 @@
---- IlmImfTest/testOptimizedInterleavePatterns.cpp.orig	2014-08-10 02:03:49 UTC
+--- IlmImfTest/testOptimizedInterleavePatterns.cpp.orig	2018-08-10 01:34:59 UTC
 +++ IlmImfTest/testOptimizedInterleavePatterns.cpp
 @@ -226,7 +226,8 @@ bool compare(const FrameBuffer& asRead,
                      writtenHalf=half(i.slice().fillValue);

Modified: head/graphics/openexr/files/patch-IlmImfUtilTest_main.cpp
==============================================================================
--- head/graphics/openexr/files/patch-IlmImfUtilTest_main.cpp	Sun Dec 29 12:11:09 2019	(r521274)
+++ head/graphics/openexr/files/patch-IlmImfUtilTest_main.cpp	Sun Dec 29 12:16:18 2019	(r521275)
@@ -1,4 +1,4 @@
---- IlmImfUtilTest/main.cpp.orig	2014-08-10 04:24:00 UTC
+--- IlmImfUtilTest/main.cpp.orig	2018-08-10 01:34:59 UTC
 +++ IlmImfUtilTest/main.cpp
 @@ -46,7 +46,7 @@
  #include <cstring>

Added: head/graphics/openexr/files/patch-IlmImf_ImfFrameBuffer.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/openexr/files/patch-IlmImf_ImfFrameBuffer.cpp	Sun Dec 29 12:16:18 2019	(r521275)
@@ -0,0 +1,91 @@
+--- IlmImf/ImfFrameBuffer.cpp.orig	2018-08-10 01:34:58 UTC
++++ IlmImf/ImfFrameBuffer.cpp
+@@ -74,6 +74,88 @@ Slice::Slice (PixelType t,
+     // empty
+ }
+ 
++Slice
++Slice::Make (
++    PixelType                   type,
++    const void*                 ptr,
++    const IMATH_NAMESPACE::V2i& origin,
++    int64_t                     w,
++    int64_t                     h,
++    size_t                      xStride,
++    size_t                      yStride,
++    int                         xSampling,
++    int                         ySampling,
++    double                      fillValue,
++    bool                        xTileCoords,
++    bool                        yTileCoords)
++{
++    char* base = reinterpret_cast<char*> (const_cast<void *> (ptr));
++    if (xStride == 0)
++    {
++        switch (type)
++        {
++            case UINT: xStride = sizeof (uint32_t); break;
++            case HALF: xStride = sizeof (uint16_t); break;
++            case FLOAT: xStride = sizeof (float); break;
++            case NUM_PIXELTYPES:
++                THROW (IEX_NAMESPACE::ArgExc, "Invalid pixel type.");
++        }
++    }
++    if (yStride == 0)
++        yStride = static_cast<size_t> (w / xSampling) * xStride;
++
++    // data window is an int, so force promote to higher type to avoid
++    // overflow for off y (degenerate size checks should be in
++    // ImfHeader::sanityCheck, but offset can be large-ish)
++    int64_t offx = (static_cast<int64_t> (origin.x) /
++                    static_cast<int64_t> (xSampling));
++    offx *= static_cast<int64_t> (xStride);
++
++    int64_t offy = (static_cast<int64_t> (origin.y) /
++                    static_cast<int64_t> (ySampling));
++    offy *= static_cast<int64_t> (yStride);
++
++    return Slice (
++        type,
++        base - offx - offy,
++        xStride,
++        yStride,
++        xSampling,
++        ySampling,
++        fillValue,
++        xTileCoords,
++        yTileCoords);
++}
++
++Slice
++Slice::Make (
++    PixelType                     type,
++    const void*                   ptr,
++    const IMATH_NAMESPACE::Box2i& dataWindow,
++    size_t                        xStride,
++    size_t                        yStride,
++    int                           xSampling,
++    int                           ySampling,
++    double                        fillValue,
++    bool                          xTileCoords,
++    bool                          yTileCoords)
++{
++    return Make (
++        type,
++        ptr,
++        dataWindow.min,
++        static_cast<int64_t> (dataWindow.max.x) -
++            static_cast<int64_t> (dataWindow.min.x) + 1,
++        static_cast<int64_t> (dataWindow.max.y) -
++            static_cast<int64_t> (dataWindow.min.y) + 1,
++        xStride,
++        yStride,
++        xSampling,
++        ySampling,
++        fillValue,
++        xTileCoords,
++        yTileCoords);
++}
+ 
+ void
+ FrameBuffer::insert (const char name[], const Slice &slice)

Added: head/graphics/openexr/files/patch-IlmImf_ImfFrameBuffer.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/openexr/files/patch-IlmImf_ImfFrameBuffer.h	Sun Dec 29 12:16:18 2019	(r521275)
@@ -0,0 +1,56 @@
+--- IlmImf/ImfFrameBuffer.h.orig	2018-08-10 01:34:58 UTC
++++ IlmImf/ImfFrameBuffer.h
+@@ -48,14 +48,15 @@
+ #include "ImfPixelType.h"
+ #include "ImfExport.h"
+ #include "ImfNamespace.h"
++#include "ImathBox.h"
+ 
+ #include <map>
+ #include <string>
++#include <cstdint>
+ 
+ 
+ OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
+ 
+-
+ //-------------------------------------------------------
+ // Description of a single slice of the frame buffer:
+ //
+@@ -148,6 +149,36 @@ struct Slice
+            double fillValue = 0.0,
+            bool xTileCoords = false,
+            bool yTileCoords = false);
++
++    // Does the heavy lifting of computing the base pointer for a slice,
++    // avoiding overflow issues with large origin offsets
++    //
++    // if xStride == 0, assumes sizeof(pixeltype)
++    // if yStride == 0, assumes xStride * ( w / xSampling )
++    static Slice Make(PixelType type,
++                      const void *ptr,
++                      const IMATH_NAMESPACE::V2i &origin,
++                      int64_t w,
++                      int64_t h,
++                      size_t xStride = 0,
++                      size_t yStride = 0,
++                      int xSampling = 1,
++                      int ySampling = 1,
++                      double fillValue = 0.0,
++                      bool xTileCoords = false,
++                      bool yTileCoords = false);
++    // same as above, just computes w and h for you
++    // from a data window
++    static Slice Make(PixelType type,
++                      const void *ptr,
++                      const IMATH_NAMESPACE::Box2i &dataWindow,
++                      size_t xStride = 0,
++                      size_t yStride = 0,
++                      int xSampling = 1,
++                      int ySampling = 1,
++                      double fillValue = 0.0,
++                      bool xTileCoords = false,
++                      bool yTileCoords = false);
+ };
+ 
+ 

Added: head/graphics/openexr/files/patch-IlmImf_ImfHeader.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/openexr/files/patch-IlmImf_ImfHeader.cpp	Sun Dec 29 12:16:18 2019	(r521275)
@@ -0,0 +1,64 @@
+--- IlmImf/ImfHeader.cpp.orig	2018-08-10 01:34:58 UTC
++++ IlmImf/ImfHeader.cpp
+@@ -785,30 +785,46 @@ Header::sanityCheck (bool isTiled, bool isMultipartFil
+ 	throw IEX_NAMESPACE::ArgExc ("Invalid data window in image header.");
+     }
+ 
+-    if (maxImageWidth > 0 &&
+-        maxImageWidth < (dataWindow.max.x - dataWindow.min.x + 1))
++    int w = (dataWindow.max.x - dataWindow.min.x + 1);
++    if (maxImageWidth > 0 && maxImageWidth < w)
+     {
+ 	THROW (IEX_NAMESPACE::ArgExc, "The width of the data window exceeds the "
+ 			    "maximum width of " << maxImageWidth << "pixels.");
+     }
+ 
+-    if (maxImageHeight > 0 &&
+-	maxImageHeight < dataWindow.max.y - dataWindow.min.y + 1)
++    int h = (dataWindow.max.y - dataWindow.min.y + 1);
++    if (maxImageHeight > 0 && maxImageHeight < h)
+     {
+-	THROW (IEX_NAMESPACE::ArgExc, "The width of the data window exceeds the "
+-			    "maximum width of " << maxImageHeight << "pixels.");
++	THROW (IEX_NAMESPACE::ArgExc, "The height of the data window exceeds the "
++			    "maximum height of " << maxImageHeight << "pixels.");
+     }
+ 
+-   // chunk table must be smaller than the maximum image area
+-   // (only reachable for unknown types or damaged files: will have thrown earlier
+-   //  for regular image types)
+-   if( maxImageHeight>0 && maxImageWidth>0 && 
+-       hasChunkCount() && chunkCount()>Int64(maxImageWidth)*Int64(maxImageHeight))
+-   {
+-       THROW (IEX_NAMESPACE::ArgExc, "chunkCount exceeds maximum area of "
+-       << Int64(maxImageWidth)*Int64(maxImageHeight) << " pixels." );
++    // make sure to avoid simple math overflow for large offsets
++    // we know we're at a positive width because of checks above
++    long long bigW = static_cast<long long>( w );
++    long long absOffY = std::abs ( dataWindow.min.y );
++    long long absOffX = std::abs ( dataWindow.min.x );
++    long long offX = static_cast<long long>( INT_MAX ) - absOffX;
++    long long offsetCount = absOffY * bigW;
++    long long bytesLeftPerLine = static_cast<long long>( INT_MAX ) / bigW;
++    if (bytesLeftPerLine < absOffY || offX < offsetCount)
++    {
++	THROW (IEX_NAMESPACE::ArgExc, "Data window [ (" << dataWindow.min.x
++	       << ", " << dataWindow.min.x << ") - (" << dataWindow.max.x
++	       << ", " << dataWindow.max.x
++	       << ") ] offset / size will overflow pointer calculations");
++    }
++
++    // chunk table must be smaller than the maximum image area
++    // (only reachable for unknown types or damaged files: will have thrown earlier
++    //  for regular image types)
++    if( maxImageHeight>0 && maxImageWidth>0 && 
++	hasChunkCount() && chunkCount()>Int64(maxImageWidth)*Int64(maxImageHeight))
++    {
++	THROW (IEX_NAMESPACE::ArgExc, "chunkCount exceeds maximum area of "
++	       << Int64(maxImageWidth)*Int64(maxImageHeight) << " pixels." );
+        
+-   }
++    }
+ 
+ 
+     //

Added: head/graphics/openexr/files/patch-IlmImf_ImfRgbaFile.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/openexr/files/patch-IlmImf_ImfRgbaFile.h	Sun Dec 29 12:16:18 2019	(r521275)
@@ -0,0 +1,68 @@
+--- IlmImf/ImfRgbaFile.h.orig	2018-08-10 01:34:58 UTC
++++ IlmImf/ImfRgbaFile.h
+@@ -60,6 +60,65 @@
+ 
+ OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
+ 
++//-------------------------------------------------------
++// Utility to compute the origin-based pointer address
++//
++// With large offsets for the data window, the naive code
++// can wrap around, especially on 32-bit machines.
++// This can be used to avoid that
++//-------------------------------------------------------
++
++inline const Rgba *
++ComputeBasePointer (
++    const Rgba*                 ptr,
++    const IMATH_NAMESPACE::V2i& origin,
++    int64_t                     w,
++    size_t                      xStride = 1,
++    size_t                      yStride = 0)
++{
++    if (yStride == 0)
++        yStride = w;
++    int64_t offx = static_cast<int64_t> (origin.x);
++    offx *= xStride;
++    int64_t offy = static_cast<int64_t> (origin.y);
++    offy *= yStride;
++    return ptr - offx - offy;
++}
++
++inline const Rgba *
++ComputeBasePointer (const Rgba* ptr, const IMATH_NAMESPACE::Box2i& dataWindow)
++{
++    return ComputeBasePointer (ptr, dataWindow.min,
++                         static_cast<int64_t> (dataWindow.max.x) -
++                          static_cast<int64_t> (dataWindow.min.x) + 1);
++}
++
++inline Rgba*
++ComputeBasePointer (
++    Rgba*                       ptr,
++    const IMATH_NAMESPACE::V2i& origin,
++    int64_t                     w,
++    size_t                      xStride = 1,
++    size_t                      yStride = 0)
++{
++    if (yStride == 0)
++        yStride = w;
++    int64_t offx = static_cast<int64_t> (origin.x);
++    offx *= xStride;
++    int64_t offy = static_cast<int64_t> (origin.y);
++    offy *= yStride;
++    return ptr - offx - offy;
++}
++
++inline Rgba*
++ComputeBasePointer (Rgba* ptr, const IMATH_NAMESPACE::Box2i& dataWindow)
++{
++    return ComputeBasePointer (
++        ptr,
++        dataWindow.min,
++        static_cast<int64_t> (dataWindow.max.x) -
++            static_cast<int64_t> (dataWindow.min.x) + 1);
++}
+ 
+ //
+ // RGBA output file.

Added: head/graphics/openexr/files/patch-IlmImf_ImfScanLineInputFile.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/openexr/files/patch-IlmImf_ImfScanLineInputFile.cpp	Sun Dec 29 12:16:18 2019	(r521275)
@@ -0,0 +1,52 @@
+--- IlmImf/ImfScanLineInputFile.cpp.orig	2018-08-10 01:34:58 UTC
++++ IlmImf/ImfScanLineInputFile.cpp
+@@ -524,14 +524,14 @@ LineBufferTask::execute ()
+     
+         if (_lineBuffer->uncompressedData == 0)
+         {
+-            int uncompressedSize = 0;
++            size_t uncompressedSize = 0;
+             int maxY = min (_lineBuffer->maxY, _ifd->maxY);
+     
+             for (int i = _lineBuffer->minY - _ifd->minY;
+                  i <= maxY - _ifd->minY;
+ 		 ++i)
+ 	    {
+-                uncompressedSize += (int) _ifd->bytesPerLine[i];
++                uncompressedSize += _ifd->bytesPerLine[i];
+ 	    }
+     
+             if (_lineBuffer->compressor &&
+@@ -628,11 +628,11 @@ LineBufferTask::execute ()
+                     //
+     
+                     char *linePtr  = slice.base +
+-                                        divp (y, slice.ySampling) *
+-                                        slice.yStride;
++                                        intptr_t( divp (y, slice.ySampling) ) *
++                                        intptr_t( slice.yStride );
+     
+-                    char *writePtr = linePtr + dMinX * slice.xStride;
+-                    char *endPtr   = linePtr + dMaxX * slice.xStride;
++                    char *writePtr = linePtr + intptr_t( dMinX ) * intptr_t( slice.xStride );
++                    char *endPtr   = linePtr + intptr_t( dMaxX ) * intptr_t( slice.xStride );
+                     
+                     copyIntoFrameBuffer (readPtr, writePtr, endPtr,
+                                          slice.xStride, slice.fill,
+@@ -838,14 +838,14 @@ LineBufferTaskIIF::execute()
+         
+         if (_lineBuffer->uncompressedData == 0)
+         {
+-            int uncompressedSize = 0;
++            size_t uncompressedSize = 0;
+             int maxY = min (_lineBuffer->maxY, _ifd->maxY);
+             
+             for (int i = _lineBuffer->minY - _ifd->minY;
+             i <= maxY - _ifd->minY;
+             ++i)
+             {
+-                uncompressedSize += (int) _ifd->bytesPerLine[i];
++                uncompressedSize += _ifd->bytesPerLine[i];
+             }
+             
+             if (_lineBuffer->compressor &&

Copied and modified: head/graphics/openexr/files/patch-IlmImf_ImfSystemSpecific.cpp (from r521274, head/graphics/openexr/files/patch-IlmImf__ImfSystemSpecific.cpp)
==============================================================================
--- head/graphics/openexr/files/patch-IlmImf__ImfSystemSpecific.cpp	Sun Dec 29 12:11:09 2019	(r521274, copy source)
+++ head/graphics/openexr/files/patch-IlmImf_ImfSystemSpecific.cpp	Sun Dec 29 12:16:18 2019	(r521275)
@@ -1,4 +1,4 @@
---- IlmImf/ImfSystemSpecific.cpp.orig	2017-11-17 23:00:24 UTC
+--- IlmImf/ImfSystemSpecific.cpp.orig	2018-08-10 01:34:58 UTC
 +++ IlmImf/ImfSystemSpecific.cpp
 @@ -44,11 +44,23 @@ namespace {
      // Helper functions for gcc + SSE enabled

Copied and modified: head/graphics/openexr/files/patch-exrenvmap_main.cpp (from r521274, head/graphics/openexr/files/patch-exrenvmap__main.cpp)
==============================================================================
--- head/graphics/openexr/files/patch-exrenvmap__main.cpp	Sun Dec 29 12:11:09 2019	(r521274, copy source)
+++ head/graphics/openexr/files/patch-exrenvmap_main.cpp	Sun Dec 29 12:16:18 2019	(r521275)
@@ -1,4 +1,4 @@
---- exrenvmap/main.cpp.orig	2014-08-10 04:24:00 UTC
+--- exrenvmap/main.cpp.orig	2018-08-10 01:35:00 UTC
 +++ exrenvmap/main.cpp
 @@ -47,6 +47,7 @@
  #include <ImfHeader.h>

Added: head/graphics/openexr/files/patch-exrenvmap_readInputImage.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/openexr/files/patch-exrenvmap_readInputImage.cpp	Sun Dec 29 12:16:18 2019	(r521275)
@@ -0,0 +1,11 @@
+--- exrenvmap/readInputImage.cpp.orig	2018-08-10 01:35:00 UTC
++++ exrenvmap/readInputImage.cpp
+@@ -194,7 +194,7 @@ readSixImages (const char inFileName[],
+                    "from the data window of other cube faces.");
+         }
+ 
+-        in.setFrameBuffer (pixels - dw.min.x - dw.min.y * w, 1, w);
++        in.setFrameBuffer (ComputeBasePointer (pixels, dw), 1, w);
+         in.readPixels (dw.min.y, dw.max.y);
+ 
+         pixels += w * h;

Added: head/graphics/openexr/files/patch-exrmakepreview_makePreview.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/openexr/files/patch-exrmakepreview_makePreview.cpp	Sun Dec 29 12:16:18 2019	(r521275)
@@ -0,0 +1,11 @@
+--- exrmakepreview/makePreview.cpp.orig	2018-08-10 01:35:00 UTC
++++ exrmakepreview/makePreview.cpp
+@@ -110,7 +110,7 @@ generatePreview (const char inFileName[],
+     int h = dw.max.y - dw.min.y + 1;
+ 
+     Array2D <Rgba> pixels (h, w);
+-    in.setFrameBuffer (&pixels[0][0] - dw.min.y * w - dw.min.x, 1, w);
++    in.setFrameBuffer (ComputeBasePointer (&pixels[0][0], dw), 1, w);
+     in.readPixels (dw.min.y, dw.max.y);
+ 
+     //

Added: head/graphics/openexr/files/patch-exrmaketiled_Image.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/openexr/files/patch-exrmaketiled_Image.h	Sun Dec 29 12:16:18 2019	(r521275)
@@ -0,0 +1,20 @@
+--- exrmaketiled/Image.h.orig	2018-08-10 01:35:00 UTC
++++ exrmaketiled/Image.h
+@@ -190,12 +190,12 @@ OPENEXR_IMF_INTERNAL_NAMESPACE::Slice
+ TypedImageChannel<T>::slice () const
+ {
+     const IMATH_NAMESPACE::Box2i &dw = image().dataWindow();
+-    int w = dw.max.x - dw.min.x + 1;
+ 
+-    return OPENEXR_IMF_INTERNAL_NAMESPACE::Slice (pixelType(),
+-		       (char *) (&_pixels[0][0] - dw.min.y * w - dw.min.x),
+-		       sizeof (T),
+-		       w * sizeof (T));
++    return OPENEXR_IMF_INTERNAL_NAMESPACE::Slice::Make (
++        pixelType(),
++        &_pixels[0][0],
++        dw,
++        sizeof (T));
+ }
+ 
+ 

Copied and modified: head/graphics/openexr/files/patch-exrmaketiled_main.cpp (from r521274, head/graphics/openexr/files/patch-exrmaketiled__main.cpp)
==============================================================================
--- head/graphics/openexr/files/patch-exrmaketiled__main.cpp	Sun Dec 29 12:11:09 2019	(r521274, copy source)
+++ head/graphics/openexr/files/patch-exrmaketiled_main.cpp	Sun Dec 29 12:16:18 2019	(r521275)
@@ -1,4 +1,4 @@
---- exrmaketiled/main.cpp.orig	2014-08-10 04:24:00 UTC
+--- exrmaketiled/main.cpp.orig	2018-08-10 01:35:00 UTC
 +++ exrmaketiled/main.cpp
 @@ -43,6 +43,7 @@
  #include "makeTiled.h"

Added: head/graphics/openexr/files/patch-exrmultiview_Image.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/openexr/files/patch-exrmultiview_Image.h	Sun Dec 29 12:16:18 2019	(r521275)
@@ -0,0 +1,45 @@
+--- exrmultiview/Image.h.orig	2018-08-10 01:35:00 UTC
++++ exrmultiview/Image.h
+@@ -159,6 +159,8 @@ TypedImageChannel<T>::TypedImageChannel
+     _ySampling (ySampling),
+     _pixels (0, 0)
+ {
++    if ( _xSampling < 1 || _ySampling < 1 )
++        throw IEX_NAMESPACE::ArgExc ("Invalid x/y sampling values");
+     resize();
+ }
+ 
+@@ -201,14 +203,14 @@ TypedImageChannel<T>::slice () const
+     const IMATH_NAMESPACE::Box2i &dw = image().dataWindow();
+     int w = dw.max.x - dw.min.x + 1;
+ 
+-    return IMF::Slice (pixelType(),
+-		       (char *) (&_pixels[0][0] -
+-				 dw.min.y / _ySampling * (w / _xSampling) -
+-				 dw.min.x / _xSampling),
+-		       sizeof (T),
+-		       (w / _xSampling) * sizeof (T),
+-		       _xSampling,
+-		       _ySampling);
++    return IMF::Slice::Make (
++        pixelType(),
++        &_pixels[0][0],
++        dw,
++        sizeof(T),
++        (w / _xSampling) * sizeof (T),
++        _xSampling,
++        _ySampling);
+ }
+ 
+ 
+@@ -227,7 +229,9 @@ template <class T>
+ void
+ TypedImageChannel<T>::black ()
+ {
+-    memset(&_pixels[0][0],0,image().width()/_xSampling*image().height()/_ySampling*sizeof(T));
++    size_t nx = static_cast<size_t>( image().width() ) / static_cast<size_t>( _xSampling );
++    size_t ny = static_cast<size_t>( image().height() ) / static_cast<size_t>( _ySampling );
++    memset(&_pixels[0][0],0,nx*ny*sizeof(T));
+ }
+ 
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912291216.xBTCGITb075473>