File tree 1 file changed +30
-0
lines changed
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 22
22
#include < ImfStdIO.h>
23
23
#include < ImfTileDescription.h>
24
24
#include < ImfXdr.h>
25
+ #include < cassert>
25
26
26
27
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
27
28
@@ -275,6 +276,20 @@ copyIntoFrameBuffer (
275
276
//
276
277
endPtr += xStride;
277
278
279
+ if (xStride == 0 )
280
+ {
281
+ throw IEX_NAMESPACE::ArgExc (" Zero stride is invalid." );
282
+ }
283
+ if ((endPtr - writePtr) / xStride <= 0 )
284
+ {
285
+ // Nothing to do, the specified range is empty.
286
+ return ;
287
+ }
288
+ if ((endPtr - writePtr) % xStride != 0 )
289
+ {
290
+ throw IEX_NAMESPACE::ArgExc (" Stride will not exactly span input data." );
291
+ }
292
+
278
293
if (fill)
279
294
{
280
295
//
@@ -1533,6 +1548,21 @@ copyFromFrameBuffer (
1533
1548
char * localWritePtr = writePtr;
1534
1549
const char * localReadPtr = readPtr;
1535
1550
endPtr += xStride;
1551
+
1552
+ if (xStride == 0 )
1553
+ {
1554
+ throw IEX_NAMESPACE::ArgExc (" Zero stride is invalid." );
1555
+ }
1556
+ if ((endPtr - localReadPtr) / xStride <= 0 )
1557
+ {
1558
+ // Nothing to do, the specified range is empty.
1559
+ return ;
1560
+ }
1561
+ if ((endPtr - localReadPtr) % xStride != 0 )
1562
+ {
1563
+ throw IEX_NAMESPACE::ArgExc (" Stride will not exactly span input data." );
1564
+ }
1565
+
1536
1566
//
1537
1567
// Copy a horizontal row of pixels from a frame
1538
1568
// buffer to an output file's line or tile buffer.
You can’t perform that action at this time.
0 commit comments