Skip to content
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

Update of LZW compressed TIFF sometimes fail #1439

Closed
rouault opened this issue Apr 11, 2019 · 0 comments
Closed

Update of LZW compressed TIFF sometimes fail #1439

rouault opened this issue Apr 11, 2019 · 0 comments
Assignees
Labels
Milestone

Comments

@rouault
Copy link
Member

rouault commented Apr 11, 2019

When rewriting a LZW tile/strip whose existing size is very close to a multiple of 1024 bytes (and larger than 8192 bytes) with compressed data that is larger, the new data is not placed at the end of the file, causing corruption.

Can be demonstrated with

from osgeo import gdal
import shutil
shutil.copy('to_be_updated_lzw.tif', 'out.tif')
ds = gdal.Open( 'out.tif', gdal.GA_Update)
src_ds = gdal.Open('update_lzw.tif')
ds.WriteRaster(0,0,4096,1,src_ds.ReadRaster())
ds = None
ds = gdal.Open( 'out.tif')
print ds.GetRasterBand(1).Checksum()

input_data.zip

@rouault rouault self-assigned this Apr 11, 2019
@rouault rouault added the bug label Apr 11, 2019
@rouault rouault added this to the 2.4.2 milestone Apr 11, 2019
rouault added a commit that referenced this issue Apr 11, 2019
…riting of LZW-compressed data

Fixes #1439

When rewriting a LZW tile/strip whose existing size is very close to a multiple of
1024 bytes (and larger than 8192 bytes) with compressed data that is larger,
the new data was not placed at the end of the file, causing corruption.
rouault added a commit to rouault/libtiff that referenced this issue Apr 11, 2019
…ressed data

Fixes OSGeo/gdal#1439

When rewriting a LZW tile/strip whose existing size is very close to a multiple of
1024 bytes (and larger than 8192 bytes) with compressed data that is larger,
the new data was not placed at the end of the file, causing corruption.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant