Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-updates-src > by-pkgid > 48fced5ef0abf43af7e530559d87f3c7 > files > 3

openexr-2.2.0-10.1.mga6.src.rpm

From 749193265ac99956f01a2dd9b20f124f2f7859d0 Mon Sep 17 00:00:00 2001
From: Shawn Walker-Salas <shawn.walker@oracle.com>
Date: Tue, 30 May 2017 19:07:52 -0700
Subject: [PATCH] Add additional input validation in an attempt to resolve
 issue #232

---
 IlmImf/ImfDwaCompressor.cpp              |   7 +-
 IlmImf/ImfHuf.cpp                        |  10 +-
 IlmImf/ImfPizCompressor.cpp              |   6 +
 IlmImfTest/CMakeLists.txt                |   1 +
 IlmImfTest/Makefile.am                   |   2 +
 IlmImfTest/comp_bad_bounds_piz.exr       | Bin 0 -> 4785 bytes
 IlmImfTest/comp_bad_neg_bounds_pxr24.exr | Bin 0 -> 3401 bytes
 IlmImfTest/comp_bad_pos_bounds_piz.exr   | Bin 0 -> 569 bytes
 IlmImfTest/comp_bad_pos_bounds_pxr24.exr | Bin 0 -> 231 bytes
 IlmImfTest/comp_early_eof_piz.exr        | Bin 0 -> 740 bytes
 IlmImfTest/comp_invalid_unknown.exr      | Bin 0 -> 786 bytes
 IlmImfTest/comp_short_decode_piz.exr     | Bin 0 -> 3147 bytes
 IlmImfTest/testMalformedImages.cpp       | 153 +++++++++++++++++++++++
 IlmImfTest/testMalformedImages.h         |  37 ++++++
 14 files changed, 211 insertions(+), 5 deletions(-)
 create mode 100644 IlmImfTest/comp_bad_bounds_piz.exr
 create mode 100644 IlmImfTest/comp_bad_neg_bounds_pxr24.exr
 create mode 100644 IlmImfTest/comp_bad_pos_bounds_piz.exr
 create mode 100644 IlmImfTest/comp_bad_pos_bounds_pxr24.exr
 create mode 100644 IlmImfTest/comp_early_eof_piz.exr
 create mode 100644 IlmImfTest/comp_invalid_unknown.exr
 create mode 100644 IlmImfTest/comp_short_decode_piz.exr
 create mode 100644 IlmImfTest/testMalformedImages.cpp
 create mode 100644 IlmImfTest/testMalformedImages.h

diff --git a/IlmImf/ImfDwaCompressor.cpp b/IlmImf/ImfDwaCompressor.cpp
index 4985be62..804cf6ca 100644
--- a/IlmImf/ImfDwaCompressor.cpp
+++ b/IlmImf/ImfDwaCompressor.cpp
@@ -2386,7 +2386,12 @@ DwaCompressor::uncompress
 
     const char *dataPtr            = inPtr + NUM_SIZES_SINGLE * sizeof(Int64);
 
-    if (inSize < headerSize + compressedSize) 
+    /* Both the sum and individual sizes are checked in case of overflow. */
+    if (inSize < (headerSize + compressedSize) ||
+        inSize < unknownCompressedSize ||
+        inSize < acCompressedSize ||
+        inSize < dcCompressedSize ||
+        inSize < rleCompressedSize)
     {
         throw Iex::InputExc("Error uncompressing DWA data"
                             "(truncated file).");
diff --git a/IlmImf/ImfHuf.cpp b/IlmImf/ImfHuf.cpp
index a375d05d..97909a5b 100644
--- a/IlmImf/ImfHuf.cpp
+++ b/IlmImf/ImfHuf.cpp
@@ -822,7 +822,7 @@ hufEncode				// return: output size (in bits)
 }
 
 
-#define getCode(po, rlc, c, lc, in, out, oe)	\
+#define getCode(po, rlc, c, lc, in, out, ob, oe)\
 {						\
     if (po == rlc)				\
     {						\
@@ -835,6 +835,8 @@ hufEncode				// return: output size (in bits)
 						\
 	if (out + cs > oe)			\
 	    tooMuchData();			\
+	else if (out - 1 < ob)			\
+	    notEnoughData();			\
 						\
 	unsigned short s = out[-1];		\
 						\
@@ -895,7 +897,7 @@ hufDecode
 		//
 
 		lc -= pl.len;
-		getCode (pl.lit, rlc, c, lc, in, out, oe);
+		getCode (pl.lit, rlc, c, lc, in, out, outb, oe);
 	    }
 	    else
 	    {
@@ -925,7 +927,7 @@ hufDecode
 			    //
 
 			    lc -= l;
-			    getCode (pl.p[j], rlc, c, lc, in, out, oe);
+			    getCode (pl.p[j], rlc, c, lc, in, out, outb, oe);
 			    break;
 			}
 		    }
@@ -952,7 +954,7 @@ hufDecode
 	if (pl.len)
 	{
 	    lc -= pl.len;
-	    getCode (pl.lit, rlc, c, lc, in, out, oe);
+	    getCode (pl.lit, rlc, c, lc, in, out, outb, oe);
 	}
 	else
 	{
diff --git a/IlmImf/ImfPizCompressor.cpp b/IlmImf/ImfPizCompressor.cpp
index 46c6fbac..8b3ee38c 100644
--- a/IlmImf/ImfPizCompressor.cpp
+++ b/IlmImf/ImfPizCompressor.cpp
@@ -573,6 +573,12 @@ PizCompressor::uncompress (const char *inPtr,
     int length;
     Xdr::read <CharPtrIO> (inPtr, length);
 
+    if (length > inSize)
+    {
+	throw InputExc ("Error in header for PIZ-compressed data "
+			"(invalid array length).");
+    }
+
     hufUncompress (inPtr, length, _tmpBuffer, tmpBufferEnd - _tmpBuffer);
 
     //
diff --git a/IlmImfTest/CMakeLists.txt b/IlmImfTest/CMakeLists.txt
index c07d9f22..42a1341b 100644
--- a/IlmImfTest/CMakeLists.txt
+++ b/IlmImfTest/CMakeLists.txt
@@ -32,6 +32,7 @@ ADD_EXECUTABLE ( IlmImfTest
   testLineOrder.cpp
   testLut.cpp
   testMagic.cpp
+  testMalformedImages.cpp
   testMultiPartApi.cpp
   testMultiPartFileMixingBasic.cpp
   testMultiPartSharedAttributes.cpp
diff --git a/IlmImfTest/Makefile.am b/IlmImfTest/Makefile.am
index 9ab5c4c4..f4324ba4 100644
--- a/IlmImfTest/Makefile.am
+++ b/IlmImfTest/Makefile.am
@@ -5,12 +5,14 @@ check_PROGRAMS = IlmImfTest
 IlmImfTest_SOURCES = main.cpp tmpDir.h testAttributes.cpp testChannels.cpp \
 		     testCompression.cpp testCopyPixels.cpp \
 		     testCustomAttributes.cpp testHuf.cpp testLineOrder.cpp \
+		     testMalformedImages.cpp \
 		     testLut.cpp testRgba.cpp testRgbaThreading.cpp \
 		     testSampleImages.cpp testSharedFrameBuffer.cpp \
 		     testWav.cpp testXdr.cpp testAttributes.h testChannels.h \
 		     testCompression.h testCopyPixels.h \
 		     testCustomAttributes.h testHuf.h testLineOrder.h \
 		     testLut.h testRgba.h testRgbaThreading.h \
+		     testMalformedImages.h \
 		     testSampleImages.h testWav.h testSharedFrameBuffer.h \
 		     testXdr.h testConversion.cpp testConversion.h \
 		     testNativeFormat.cpp testNativeFormat.h \
diff --git a/IlmImfTest/comp_bad_bounds_piz.exr b/IlmImfTest/comp_bad_bounds_piz.exr
new file mode 100644
index 0000000000000000000000000000000000000000..9add853498e25a99c6e7770a9ee82a4bba2c7807
GIT binary patch
literal 4785
zcmeHJy-ve05Wb*FR7`z@jz|o3i;&n_U|>Y*(m5oqYAHBT9F;PqO9!5-Pk|VC50-LH
z3e-u{G)awA5lc?a_w(KP(>czx(=|>2z?ztxQ%9iSFcAR3aSH}oq$J;R-lsIflm;yK
z$@8fY%;kzKff}|Mm?Oq*_Zc4DS&v2V1fk`Sc`k6;On8p@lJ+BHg&=Z9!(p60_%`+7
zSCR(s*o-<i!lPC&Gy~?s*m2ExQ)uoB%cqpb@OP942r%u9<5D7ELN;AS%nl|h1c6t{
zhpf5WfOaA-0z=ICDKx+Nh;+IiVLE{!Ym3!}vcX2TzdF!3S8>iTovP8lYU)q1E5pYw
zW0tK{5P~fi<g;|MCR%mt66RagwNf(!cy0!oQ`GQB!a(v)$uGO^o_vn}i${L<TveoE
z_4DUe5lCbBwThi}57+uN1FZx6xGfjW5LDiatXg|GclPip>=G7^r~_&S)(nJrfHujn
pE1ZB$oMV*}AKqi#Mv1z$e4DcCc*{2Zv8BC#%U=%gp270ozX0@k`uP9=

literal 0
HcmV?d00001

diff --git a/IlmImfTest/comp_bad_neg_bounds_pxr24.exr b/IlmImfTest/comp_bad_neg_bounds_pxr24.exr
new file mode 100644
index 0000000000000000000000000000000000000000..beb69126a13d18b479a4ff5f6e98917a011c5819
GIT binary patch
literal 3401
zcmcgtF=!M~5dAq4yrhbiAYwMBkfhN3h_%^7#3pF4FqOr5yD=+wyYY6p1VYF)qL9K`
zY!o$xorOuO2sT>SSp-ZG5D|hFAs|HJ%>4bk|L^UsdkHw){+W66X8!!yz1_y>SXZII
zSY@v4x^~qEqw4qp<0!0)F|ttOHPwP#1ytu4EeNZ4RE{%0s5|Z*HWa1^G;^(ZwfVa3
z`;O;Anb^jp9;+ObXB^k^7T9fX@q$CWehTG>G}QVEPleI0I<9@aZrODfTZl7iKBM(Z
z$V!oUXVI=s`15upxKR!qkIh!SayVJe$Nfs(wq4QwW!nv4<Hm(qG5D~WN||x2U`{W=
z1E*^H3|GtcE0k)&Xz}V=kR8d+j{^!Atm1yjIG>2DyvB51Vy8T6?ud&e^YMZ0Tn3dC
zsE|0pl$amjAx-Kit0*j!RDX%BfKglDO#LnQ3GzSJ{xpW6f+jd2fMzIgfReOHcOO$+
z_}d>s%v?DIdQ;@0rjwd!u!#>hO&CrF?H9!YRBb{K#Az6WBONb|p&eZo1X7An^g9L2
zlyDl<j@O+=)-Y<4b|ko6p#hns9V!!KtSRHIng%9eLmIiXnZ+`~AhwB@^zpXEq8_5D
zMSx=>F9{-sLVat^3tX;E!AVP3?nP)K8LvpRv}hNJn%I^hd#nC`!DeCq<SQ!i#yY$^
zrlrD0QhKD3SIdz_{AienoQPmFc<4zjgGw`uDK}5XrPixSlyvyNGRcV_I%yezHz_7w
zF~U48RP^kc($BBs|8tbnu1e~`no$}U{a0WTw=Qyi=AbbCtF-_8_bA^!zxwd**^|6y
z?bW>!gx98Ce|X0?`5XQbyq`3>FPwjSOcpKO{2)u--!D$D^BVr>)3wv)3zqs>YXP?=
zmkI;BBMtQ{xTiWD+snQC#g)%5M2BIYOD+3$P`11~%m)u9AH_BB!+n%fZ}4YtAN=V%
zr`7n{K}&HfVTmnk6~;K+&}w)sG%YOdc=V2tPg49Kpmi#8vx_bFahUqkXzH}nhIT-0
z^XzIE-5tTHuOx_hifq@`Zzj^v-QX`_>b*OOrjouMb`|%UVpILC$tN)Np+=&qy@dZ4
Db(bi~

literal 0
HcmV?d00001

diff --git a/IlmImfTest/comp_bad_pos_bounds_piz.exr b/IlmImfTest/comp_bad_pos_bounds_piz.exr
new file mode 100644
index 0000000000000000000000000000000000000000..5cedaa6a83104f2f1b4c806486dad748af19f25a
GIT binary patch
literal 569
zcmb7BF%H5o40I6>0Es^^Qg{Kdu(NayZ3>Y>Qq@rl8{&`r2RluNDq-NH_MCIhc9L$h
z&1L{l-h?qyBL!NagPd@Hj4~WC^LLDtQ>2_D1xkBwT8XHvnZ#UrUI`}(Wh&dl#Xfe*
zH{^_m90TIWn+LC^T*4cymBL1gXMw!-)nO6N6?S-{A_JxajOw3E4FD{g09~uh71oKK
zKZ?E*I&`~wG8vYwlxDcOLcOU`t*sbdj{Qz)iNOC#VoBB&tDikxLDqA~7>8S?hT|i6
J_?_b-@E1@ebKn2~

literal 0
HcmV?d00001

diff --git a/IlmImfTest/comp_bad_pos_bounds_pxr24.exr b/IlmImfTest/comp_bad_pos_bounds_pxr24.exr
new file mode 100644
index 0000000000000000000000000000000000000000..18761ffb3c1648356b1cc811bad67580048a2cdb
GIT binary patch
literal 231
zcmaKm%?biB41{L|pT(m;FX7Rn=ejK#sL9e4_3`Z#7uSmeNhW*=$z!`8RshCZP)*sJ
z$>J5erXxt`hE^FE?LL*{E~Y=8L+co7IEzMm;$p9Z^wpk-XJyfJDlrv&9T}`=uSN8V
S&FAvG^`}lt#wQmdV*3Wu3o{G=

literal 0
HcmV?d00001

diff --git a/IlmImfTest/comp_early_eof_piz.exr b/IlmImfTest/comp_early_eof_piz.exr
new file mode 100644
index 0000000000000000000000000000000000000000..f6ed73a51a379d23f540d0d81baf20a0d03b2c7b
GIT binary patch
literal 740
zcmbVJy-ve05WX}SfT4ns&0=6fKo>@SI<R*M0}RG?i6s+9u@yQZ@dA~210I2ejW^&4
zm{Er=jAbGC;!>rF=)g(2@5^_W@6JxKe;9NCfF(3dg))vPX)GK$?F<5!F%a=NZz+S8
z0!-g#xiCiRbcv%u#HppROu4>;Ydz{o*mNq!m$V6CTIqa`X)ZWXqHz1HGFxw(eU|07
z_k+OA<BoG_GDR=rhuY9tS(fuQ2;K1$OLhsRH<D!|p-xREm>p0nH4K%e7NV;8{@Acw
zh}7@j7pWCF6ulv={dzg9x5Sd$q+tQ?cn>a~jmPPvLb8433y*IeU;7=Hxh=;p_<sPp
z2VsTblgDv4f{jYSbh2Q}WIhbVEleMab5Cn`fR(=^A-;C8;}Jb;zFutPRrUJ!tNI$2
H|9<@eYF=>5

literal 0
HcmV?d00001

diff --git a/IlmImfTest/comp_invalid_unknown.exr b/IlmImfTest/comp_invalid_unknown.exr
new file mode 100644
index 0000000000000000000000000000000000000000..9a322474f7860b1c408f15175e78639d4cf9564e
GIT binary patch
literal 786
zcma)&Jxc>Y5QZnlLP4VjL==@nB^G`p2JxfvBb6WsX`+STdbcL4=We)Nqp6bKMiBpi
zot=terT@U%!ot$d()QfFIZa{^JlJ_=-+5<exKeT^(gFZ>fpAV;sS}q;1&dl+-GYdQ
zImTj6wpkK^LDzoFV2i_|N2O$fH{|A}c84gEW84wPuq#f|47yEk_z^wiLfafBi!LcQ
z`YNI6&G&agpUXJi@EqzvEi+R<9CIy7<uRUzaV=!TY1w1>g0j-7)SR`(og-5vuC*Sh
z35$?Cvx_IxU6Dm<t1MAWz@96Jg4SSibxGPDr5v})P_FcdQhE>Cf-;7BOO83J5IzCm
zYeRJjUW5GrZl!7X@YOpu_HSe1{2BR_F+UvO>;V}|MT2|v5_uiNtpc$Y>i?!z!(p|0
zQ&zB0+8jYHBmNtIxA%>HcMf!57VktZbRqA;6=e_J_v6TyUgYB-@@5EmHH`dgQfv(C
cl>~Bm0y#U0oS#B|hP<D~yGkMtQphlV0Y>L^Z~y=R

literal 0
HcmV?d00001

diff --git a/IlmImfTest/comp_short_decode_piz.exr b/IlmImfTest/comp_short_decode_piz.exr
new file mode 100644
index 0000000000000000000000000000000000000000..3a16d594b3028f3d83831f7cba0e237d79bc397f
GIT binary patch
literal 3147
zcmeHJJx{|h5WS#Cz*g}C5Ptw+x^{!15(^Sb=McN9C1XdiRbZkkf0BQ}#1Q-(KHR32
zij*M|ep2GQcQ1G6i}JC&xXccSs9Y3U3uV2bq;+(|7`yU3kvCZ8R~*xDj+wg-L#27B
zYGJK3dd<dVIWJr>lbV}Hx;IZ_8PdP3ng*o+l;P4=s(9|`kRgVWTHMxL)bwj1PF1V|
zF;}K=p%x;xtcB2R`fH(`Pp}-%f5MxRndEM<k%C^)s0YM-0J+YOiB^Yn)TU;jV&t(y
z&D)wAJ72BE)GqsMTOh-Rz5}qGcd+Ie@Ij-n;?&+S#QqIV2EEhMp>+2?lt%v8$F!pl
nk3)y;lfc_{A58WUB~6+@nn0RBnn0SsmI?I!HN!8YuhV=23gJXB

literal 0
HcmV?d00001

diff --git a/IlmImfTest/testMalformedImages.cpp b/IlmImfTest/testMalformedImages.cpp
new file mode 100644
index 00000000..e472dfc0
--- /dev/null
+++ b/IlmImfTest/testMalformedImages.cpp
@@ -0,0 +1,153 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2002-2012, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// *       Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// *       Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// *       Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+#include <ImfAcesFile.h>
+#include <ImfArray.h>
+#include <ImfRgbaFile.h>
+#include <IlmThread.h>
+#include <stdio.h>
+#include <assert.h>
+
+#ifndef ILM_IMF_TEST_IMAGEDIR
+    #define ILM_IMF_TEST_IMAGEDIR
+#endif
+
+
+using namespace OPENEXR_IMF_NAMESPACE;
+using namespace std;
+using namespace IMATH_NAMESPACE;
+
+
+namespace {
+
+void
+readImage (const char inFileName[])
+{
+	Array2D<Rgba> p;
+	Header h;
+	RgbaChannels ch;
+	Box2i dw;
+	int width;
+	int height;
+
+	{
+		cout << "Reading file " << inFileName << endl;
+
+		AcesInputFile in (inFileName);
+
+		h = in.header();
+		ch = in.channels();
+		dw = h.dataWindow();
+
+		width  = dw.max.x - dw.min.x + 1;
+		height = dw.max.y - dw.min.y + 1;
+		p.resizeErase (height, width);
+
+		in.setFrameBuffer (&p[0][0] - dw.min.x - dw.min.y * width, 1, width);
+		in.readPixels (dw.min.y, dw.max.y);
+	}
+}
+
+void
+readBadBoundsImage (const char fileName[])
+{
+    cout << "file " << fileName << " " << flush;
+
+    OPENEXR_IMF_NAMESPACE::RgbaInputFile in (fileName);
+
+    cout << "version " << in.version() << " " << flush;
+
+    const Box2i &dw = in.dataWindow();
+}
+
+} // namespace
+
+void
+testMalformedImages (const std::string&)
+{
+	try
+	{
+		// id:000012,sig:11,src:000328+001154,op:splice,rep:16
+		readImage (ILM_IMF_TEST_IMAGEDIR "comp_short_decode_piz.exr");
+		cerr << "Malformed Images : InputFile : incorrect input file passed\n";
+		assert (false);
+	}
+	catch (const IEX_NAMESPACE::BaseExc &e)
+	{
+		// expected behaviour
+	}
+
+	try
+	{
+		// id:000077,sig:11,src:002575,op:havoc,rep:4
+		readImage (ILM_IMF_TEST_IMAGEDIR "comp_invalid_unknown.exr");
+		cerr << "Malformed Images : InputFile : incorrect input file passed\n";
+		assert (false);
+	}
+	catch (const IEX_NAMESPACE::IoExc &e)
+	{
+		// expected behaviour
+	}
+
+	try
+	{
+		// id:000103,sig:11,src:002037+004745,op:splice,rep:2
+		readImage (ILM_IMF_TEST_IMAGEDIR "comp_early_eof_piz.exr");
+		cerr << "Malformed Images : InputFile : incorrect input file passed\n";
+		assert (false);
+	}
+	catch (const IEX_NAMESPACE::InputExc &e)
+	{
+		// expected behaviour
+	}
+
+	// The files below expose a bug in the test code (readImage which uses the
+	// logic taken from exr2aces) that calculates an invalid pointer for the
+	// framebuffer.  The dataWindow and displayWindow values used in these files
+	// seem valid based on a cursory reading of the OpenEXR specification. As
+	// such, the best we can do is ensure that parsing the basic header
+	// information doesn't cause any unexpected exceptions.
+
+	// id:000087,sig:11,src:000562+000300,op:splice,rep:2
+	readBadBoundsImage (ILM_IMF_TEST_IMAGEDIR "comp_bad_pos_bounds_piz.exr");
+
+	// id:000104,sig:11,src:001329+000334,op:splice,rep:2
+	readBadBoundsImage (ILM_IMF_TEST_IMAGEDIR "comp_bad_pos_bounds_pxr24.exr");
+
+	// id:000131,sig:11,src:000514+002831,op:splice,rep:16
+	readBadBoundsImage (ILM_IMF_TEST_IMAGEDIR "comp_bad_neg_bounds_pxr24.exr");
+
+	// id:000132,sig:11,src:000895,op:havoc,rep:32
+	readBadBoundsImage (ILM_IMF_TEST_IMAGEDIR "comp_bad_bounds_piz.exr");
+}
diff --git a/IlmImfTest/testMalformedImages.h b/IlmImfTest/testMalformedImages.h
new file mode 100644
index 00000000..43d52084
--- /dev/null
+++ b/IlmImfTest/testMalformedImages.h
@@ -0,0 +1,37 @@
+///////////////////////////////////////////////////////////////////////////
+//
+// Copyright (c) 2002-2012, Industrial Light & Magic, a division of Lucas
+// Digital Ltd. LLC
+//
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+// *       Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// *       Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// *       Neither the name of Industrial Light & Magic nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+///////////////////////////////////////////////////////////////////////////
+
+#include <string>
+
+void testMalformedImages (const std::string &tempDir);