diff --git a/src/libtexture/imagecache.cpp b/src/libtexture/imagecache.cpp index da8380fa9a..f4937a26b4 100644 --- a/src/libtexture/imagecache.cpp +++ b/src/libtexture/imagecache.cpp @@ -840,6 +840,7 @@ ImageCacheFile::read_tile(ImageCachePerThreadInfo* thread_info, int subimage, } } if (!ok) { + m_broken = true; std::string err = inp->geterror(); if (errors_should_issue()) { imagecache().error("{}", diff --git a/src/tiff.imageio/tiffinput.cpp b/src/tiff.imageio/tiffinput.cpp index 62bf5398d1..28d2a77590 100644 --- a/src/tiff.imageio/tiffinput.cpp +++ b/src/tiff.imageio/tiffinput.cpp @@ -2157,8 +2157,9 @@ TIFFInput::read_native_tiles(int subimage, int miplevel, int xbegin, int xend, // xbegin, xend, ybegin, yend, zbegin, zend); size_t tileidx = 0; for (int z = zbegin; z < zend; z += m_spec.tile_depth) { - for (int y = ybegin; y < yend; y += m_spec.tile_height) { - for (int x = xbegin; x < xend; x += m_spec.tile_width, ++tileidx) { + for (int y = ybegin; ok && y < yend; y += m_spec.tile_height) { + for (int x = xbegin; ok && x < xend; + x += m_spec.tile_width, ++tileidx) { char* cbuf = compressed_scratch.get() + tileidx * cbound; char* ubuf = scratch.get() + tileidx * tile_bytes; auto csize = TIFFReadRawTile(m_tif, tile_index(x, y, z), cbuf, @@ -2168,7 +2169,8 @@ TIFFInput::read_native_tiles(int subimage, int miplevel, int xbegin, int xend, errorf( "TIFFReadRawTile failed reading tile x=%d,y=%d,z=%d: %s", x, y, z, err.size() ? err.c_str() : "unknown error"); - return false; + ok = false; + break; } // Push the rest of the work onto the thread pool queue auto out = this; @@ -2193,6 +2195,7 @@ TIFFInput::read_native_tiles(int subimage, int miplevel, int xbegin, int xend, } } } + tasks.wait(); return ok; } diff --git a/testsuite/tiff-misc/ref/out-libtiff403.txt b/testsuite/tiff-misc/ref/out-libtiff403.txt index 206e2e2766..cf9932e6ab 100644 --- a/testsuite/tiff-misc/ref/out-libtiff403.txt +++ b/testsuite/tiff-misc/ref/out-libtiff403.txt @@ -22,6 +22,8 @@ Full command line was: > oiiotool --oiioattrib try_all_readers 0 --info -v src/crash-1633.tif oiiotool ERROR: read : File does not exist: "src/crash-1643.tif" Full command line was: -> oiiotool --oiioattrib try_all_readers 0 --info -v src/crash-1643.tif +> oiiotool --oiioattrib try_all_readers 0 --info src/crash-1643.tif -o out.exr +iconvert ERROR copying "src/crash-1709.tif" to "crash-1709.exr" : + Decoding error at scanline 0, incorrect header check Comparing "check1.tif" and "ref/check1.tif" PASS diff --git a/testsuite/tiff-misc/ref/out-libtiff410.txt b/testsuite/tiff-misc/ref/out-libtiff410.txt new file mode 100644 index 0000000000..477c237db6 --- /dev/null +++ b/testsuite/tiff-misc/ref/out-libtiff410.txt @@ -0,0 +1,29 @@ +Reading src/separate.tif +src/separate.tif : 128 x 128, 3 channel, uint8 tiff + SHA-1: 486088DECAE711C444FDCAB009C378F7783AD9C5 + channel list: R, G, B + compression: "zip" + DateTime: "2020:10:25 15:32:04" + Orientation: 1 (normal) + planarconfig: "separate" + Software: "OpenImageIO 2.3.0dev : oiiotool --pattern fill:topleft=0,0,0:topright=1,0,0:bottomleft=0,1,0:bottomright=1,1,1 128x128 3 --planarconfig separate -scanline -attrib tiff:rowsperstrip 17 -d uint8 -o separate.tif" + oiio:BitsPerSample: 8 + tiff:Compression: 8 + tiff:PhotometricInterpretation: 2 + tiff:PlanarConfiguration: 2 + tiff:RowsPerStrip: 7 +Comparing "src/separate.tif" and "separate.tif" +PASS +oiiotool ERROR: read : No support for data format of "src/corrupt1.tif" +Full command line was: +> oiiotool --oiioattrib try_all_readers 0 --info -v src/corrupt1.tif +oiiotool ERROR: read : File does not exist: "src/crash-1633.tif" +Full command line was: +> oiiotool --oiioattrib try_all_readers 0 --info -v src/crash-1633.tif +oiiotool ERROR: read : File does not exist: "src/crash-1643.tif" +Full command line was: +> oiiotool --oiioattrib try_all_readers 0 --info src/crash-1643.tif -o out.exr +iconvert ERROR copying "src/crash-1709.tif" to "crash-1709.exr" : + Decoding error at scanline 0, incorrect header check +Comparing "check1.tif" and "ref/check1.tif" +PASS diff --git a/testsuite/tiff-misc/ref/out.txt b/testsuite/tiff-misc/ref/out.txt index 1cdf173910..9c6ee4260d 100644 --- a/testsuite/tiff-misc/ref/out.txt +++ b/testsuite/tiff-misc/ref/out.txt @@ -22,6 +22,8 @@ Full command line was: > oiiotool --oiioattrib try_all_readers 0 --info -v src/crash-1633.tif oiiotool ERROR: read : File does not exist: "src/crash-1643.tif" Full command line was: -> oiiotool --oiioattrib try_all_readers 0 --info -v src/crash-1643.tif +> oiiotool --oiioattrib try_all_readers 0 --info src/crash-1643.tif -o out.exr +iconvert ERROR copying "src/crash-1709.tif" to "crash-1709.exr" : + Comparing "check1.tif" and "ref/check1.tif" PASS diff --git a/testsuite/tiff-misc/run.py b/testsuite/tiff-misc/run.py index 6e3262d510..cb14f8845b 100755 --- a/testsuite/tiff-misc/run.py +++ b/testsuite/tiff-misc/run.py @@ -17,6 +17,7 @@ # Test bugs we had until OIIO 2.4 for these corrupt file command += oiiotool ("--oiioattrib try_all_readers 0 --info -v src/corrupt1.tif", failureok = True) command += oiiotool ("--oiioattrib try_all_readers 0 --info -v src/crash-1633.tif", failureok = True) -command += oiiotool ("--oiioattrib try_all_readers 0 --info -v src/crash-1643.tif", failureok = True) +command += oiiotool ("--oiioattrib try_all_readers 0 --info src/crash-1643.tif -o out.exr", failureok = True) +command += iconvert ("src/crash-1709.tif crash-1709.exr", failureok=True) outputs = [ "check1.tif", "out.txt" ] diff --git a/testsuite/tiff-misc/src/crash-1709.tif b/testsuite/tiff-misc/src/crash-1709.tif new file mode 100644 index 0000000000..dedf3f14e4 Binary files /dev/null and b/testsuite/tiff-misc/src/crash-1709.tif differ