-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reproducible Demo: Writing a broken TIF in rasterio #4538
Comments
Minimum deterministic reproducer with
output:
|
GDAL only somewhat minimal reproducer:
|
rouault
added a commit
that referenced
this issue
Sep 23, 2021
Internal libtiff: fix rewrite in place that could cause corruption in some situations. (fixes #4538)
github-actions bot
pushed a commit
that referenced
this issue
Sep 23, 2021
Internal libtiff: fix rewrite in place that could cause corruption in some situations. (fixes #4538)
rouault
added a commit
that referenced
this issue
Sep 24, 2021
[Backport release/3.3] Internal libtiff: fix rewrite in place that could cause corruption in some situations. (fixes #4538)
jollaitbot
pushed a commit
to sailfishos-mirror/libtiff
that referenced
this issue
Sep 24, 2021
reproducable in particular with packbits compression. Fixes OSGeo/gdal#4538
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This issue was first reported with rasterio but the error is just pasted through from gdal, so I closed it there.
I stumbled over this multiple times in various configurations, e.g. the window size, value range and band number seem to be important. As you can see I nest the code in an endless while loop since the exception doesn't occur every time for me.
Notably, the error occurs while writing, not reading. In my real-world example it actually throws an error while reading.
The problem itself disappears when i) not packbits is used, ii) band count of the target is different (e.g. 3 bands), iii) the window size is different, iii) the value range is different (e.g. random * 100) or iv) sometimes just randomly.
I'm pretty sure I saw this problem also with other compression styles, but this is a first example with packbits.
I run Big Sur
rasterio 1.2.6 py39h906574e_2 conda-forge
gdal 3.3.1 py39h0530131_1 conda-forge
numpy 1.21.1 py39h7eed0ac_0 conda-forge
ERROR 1: PackBitsDecode:Not enough data for scanline 256
ERROR 1: TIFFReadEncodedTile() failed.
...
Traceback (most recent call last):
File "rasterio/_io.pyx", line 1382, in rasterio._io.DatasetWriterBase.write
File "rasterio/shim_rasterioex.pxi", line 142, in rasterio._shim.io_multi_band
File "rasterio/_err.pyx", line 190, in rasterio._err.exc_wrap_int
rasterio._err.CPLE_AppDefinedError: /Users/bug.tif, band 1: IReadBlock failed at X offset 2, Y offset 2: TIFFReadEncodedTile() failed.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/Library/Application Support/JetBrains/PyCharmCE2021.2/scratches/bug.py", line 41, in
trg.write(data.astype(profile['dtype']), window=window)
File "rasterio/_io.pyx", line 1384, in rasterio._io.DatasetWriterBase.write
rasterio.errors.RasterioIOError: Read or write failed. /Users/bug.tif, band 1: IReadBlock failed at X offset 2, Y offset 2: TIFFReadEncodedTile() failed.
Process finished with exit code 1
The text was updated successfully, but these errors were encountered: