-
Notifications
You must be signed in to change notification settings - Fork 606
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix out-of-bounds reads when using OpenEXR decreasingY lineOrder.
OpenEXR expects to process scanlines in decreasing order when the decreasingY lineOrder option is enabled. This change fixes the code that provides the chunks of scanlines to OpenEXR so that the proper scanlines are available when it accesses the FrameBuffer OIIO created. The old code was providing incorrect scanlines AND setting up the FrameBuffer with incorrect pointers so out-of-bounds reads were occurring. Signed-off-by: Aaron Colwell <[email protected]>
- Loading branch information
Showing
6 changed files
with
174 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
Reading ref/decreasingY-resize.exr | ||
ref/decreasingY-resize.exr : 4080 x 3072, 3 channel, half openexr | ||
SHA-1: 34A9F9879CD89E718ABCEE718A779035F6F78666 | ||
channel list: R, G, B | ||
compression: "zip" | ||
DateTime: "2013:04:16 10:20:35" | ||
Orientation: 1 (normal) | ||
PixelAspectRatio: 1 | ||
ResolutionUnit: "in" | ||
screenWindowCenter: 0, 0 | ||
screenWindowWidth: 1 | ||
Software: "OpenImageIO 2.6.2.0dev : oiiotool ../common/tahoe-tiny.tif --resize 4080x3072 -o ref/decreasingY-resize.exr" | ||
XResolution: 72 | ||
YResolution: 72 | ||
Exif:ImageHistory: "oiiotool ../common/tahoe-tiny.tif --resize 4080x3072 -o ref/decreasingY-resize.exr" | ||
oiio:ColorSpace: "Linear" | ||
oiio:subimages: 1 | ||
Reading ref/decreasingY-copy.exr | ||
ref/decreasingY-copy.exr : 4080 x 3072, 3 channel, half openexr | ||
SHA-1: 34A9F9879CD89E718ABCEE718A779035F6F78666 | ||
channel list: R, G, B | ||
compression: "zip" | ||
DateTime: "2013:04:16 10:20:35" | ||
Orientation: 1 (normal) | ||
PixelAspectRatio: 1 | ||
ResolutionUnit: "in" | ||
screenWindowCenter: 0, 0 | ||
screenWindowWidth: 1 | ||
Software: "OpenImageIO 2.6.2.0dev : oiiotool ref/decreasingY-resize.exr -o ref/decreasingY-copy.exr" | ||
XResolution: 72 | ||
YResolution: 72 | ||
Exif:ImageHistory: "oiiotool ../common/tahoe-tiny.tif --resize 4080x3072 -o ref/decreasingY-resize.exr | ||
oiiotool ref/decreasingY-resize.exr -o ref/decreasingY-copy.exr" | ||
oiio:ColorSpace: "Linear" | ||
oiio:subimages: 1 | ||
Reading decreasingY-resize.exr | ||
decreasingY-resize.exr : 4080 x 3072, 3 channel, half openexr | ||
SHA-1: 34A9F9879CD89E718ABCEE718A779035F6F78666 | ||
channel list: R, G, B | ||
compression: "zip" | ||
DateTime: "2013:04:16 10:20:35" | ||
Orientation: 1 (normal) | ||
PixelAspectRatio: 1 | ||
ResolutionUnit: "in" | ||
screenWindowCenter: 0, 0 | ||
screenWindowWidth: 1 | ||
Software: "OpenImageIO 2.6.2.0dev : oiiotool ../common/tahoe-tiny.tif --resize 4080x3072 --attrib openexr:lineOrder decreasingY -o decreasingY-resize.exr" | ||
XResolution: 72 | ||
YResolution: 72 | ||
Exif:ImageHistory: "oiiotool ../common/tahoe-tiny.tif --resize 4080x3072 --attrib openexr:lineOrder decreasingY -o decreasingY-resize.exr" | ||
oiio:ColorSpace: "Linear" | ||
oiio:subimages: 1 | ||
Reading decreasingY-copy.exr | ||
decreasingY-copy.exr : 4080 x 3072, 3 channel, half openexr | ||
SHA-1: 34A9F9879CD89E718ABCEE718A779035F6F78666 | ||
channel list: R, G, B | ||
compression: "zip" | ||
DateTime: "2013:04:16 10:20:35" | ||
Orientation: 1 (normal) | ||
PixelAspectRatio: 1 | ||
ResolutionUnit: "in" | ||
screenWindowCenter: 0, 0 | ||
screenWindowWidth: 1 | ||
Software: "OpenImageIO 2.6.2.0dev : oiiotool ref/decreasingY-resize.exr --attrib openexr:lineOrder decreasingY -o decreasingY-copy.exr" | ||
XResolution: 72 | ||
YResolution: 72 | ||
Exif:ImageHistory: "oiiotool ../common/tahoe-tiny.tif --resize 4080x3072 -o ref/decreasingY-resize.exr | ||
oiiotool ref/decreasingY-resize.exr --attrib openexr:lineOrder decreasingY -o decreasingY-copy.exr" | ||
oiio:ColorSpace: "Linear" | ||
oiio:subimages: 1 | ||
Comparing "decreasingY-resize.exr" and "ref/decreasingY-resize.exr" | ||
PASS | ||
Comparing "decreasingY-copy.exr" and "ref/decreasingY-copy.exr" | ||
PASS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python | ||
|
||
# Copyright Contributors to the OpenImageIO project. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# https://github.com/AcademySoftwareFoundation/OpenImageIO | ||
|
||
import os, sys | ||
|
||
#################################################################### | ||
# Verify decreasingY line order generates same image as increasingY (default). | ||
#################################################################### | ||
|
||
# Capture error output | ||
redirect = " >> out.txt 2>&1 " | ||
|
||
# Create reference images stored in increasingY order (default) | ||
# Resizing to a large image size to ensure scanline chunking logic is triggered. | ||
command += oiiotool("../common/tahoe-tiny.tif --resize 4080x3072 -o ref/decreasingY-resize.exr") | ||
command += info_command("ref/decreasingY-resize.exr") | ||
command += oiiotool("ref/decreasingY-resize.exr -o ref/decreasingY-copy.exr") | ||
command += info_command("ref/decreasingY-copy.exr") | ||
|
||
# Create an image in decreasing order via resizing (Tests ImageOutput::write_image() logic) | ||
command += oiiotool("../common/tahoe-tiny.tif --resize 4080x3072 --attrib openexr:lineOrder decreasingY -o decreasingY-resize.exr") | ||
command += info_command("decreasingY-resize.exr") | ||
|
||
# Create an image in decreasing order via copying a reference image. (Tests ImageBuf::write() logic) | ||
command += oiiotool("ref/decreasingY-resize.exr --attrib openexr:lineOrder decreasingY -o decreasingY-copy.exr") | ||
command += info_command("decreasingY-copy.exr") | ||
|
||
# Outputs to check against references. | ||
# This makes sure the images look the same since the line order is a storage detail and should not | ||
# change how the image actually looks. These comparisons help verify chunk order and scanlines are | ||
# processed properly. | ||
outputs = [ | ||
"decreasingY-resize.exr", | ||
"decreasingY-copy.exr", | ||
] | ||
|
||
|
||
#print "Running this command:\n" + command + "\n" |