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

[pull] master from OSGeo:master #136

Merged
merged 8 commits into from
Jan 7, 2025
Binary file added autotest/gcore/data/gtiff/lzw_corrupted.tif
Binary file not shown.
7 changes: 7 additions & 0 deletions autotest/gcore/libertiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,3 +859,10 @@ def test_libertiff_read_geomatrix():
def test_libertiff_num_threads_saturated():

libertiff_open("data/byte.tif", open_options=["NUM_THREADS=10000"])


def test_libertiff_corrupted_lzw():

ds = libertiff_open("data/gtiff/lzw_corrupted.tif")
with pytest.raises(Exception):
ds.ReadRaster()
7 changes: 7 additions & 0 deletions autotest/gcore/tiff_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -5575,3 +5575,10 @@ def test_tiff_read_corrupted_vat_dbf(tmp_vsimem):
band = ds.GetRasterBand(1)
with pytest.raises(Exception):
band.GetDefaultRAT()


def test_tiff_read_corrupted_lzw():

ds = gdal.Open("data/gtiff/lzw_corrupted.tif")
with pytest.raises(Exception):
ds.ReadRaster()
23 changes: 23 additions & 0 deletions autotest/ogr/ogr_gml_geom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2388,6 +2388,29 @@ def test_gml_CircleByCenterPoint_srs_geog_uom_m_km():
ogrtest.check_feature_geometry(geom1, geom2)


###############################################################################
# Test GML CircleByCenterPoint with unhandled uom


def test_gml_CircleByCenterPoint_srs_geog_unnhandled_uom():

gml = '<gml:CircleByCenterPoint gml:id="geom_id" srsName="urn:ogc:def:crs:EPSG::4326"><gml:pos>49 2</gml:pos><gml:radius uom="unhandled">2000</gml:radius></gml:CircleByCenterPoint>'
with gdaltest.disable_exceptions(), gdal.quiet_errors():
ogr.CreateGeometryFromGML(gml)
assert (
gdal.GetLastErrorMsg()
== "GML geometry id='geom_id': Unhandled distance unit 'unhandled' in attribute 'radius'"
)

gml = '<gml:CircleByCenterPoint srsName="urn:ogc:def:crs:EPSG::4326"><gml:pos>2 49</gml:pos><gml:radius uom="unhandled">2000</gml:radius></gml:CircleByCenterPoint>'
with gdaltest.disable_exceptions(), gdal.quiet_errors():
ogr.CreateGeometryFromGML(gml)
assert (
gdal.GetLastErrorMsg()
== "Unhandled distance unit 'unhandled' in attribute 'radius'"
)


###############################################################################
# Test compound curve of ArcByCenterPoint whose ends don't exactly match
# with ends of neighbouring curves, as found in some AIXM files
Expand Down
2 changes: 1 addition & 1 deletion doc/source/drivers/raster/gtiff.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ metadata :
- TIFFTAG_RESOLUTIONUNIT
- TIFFTAG_MINSAMPLEVALUE (read only)
- TIFFTAG_MAXSAMPLEVALUE (read only)
- `GEO_METADATA <https://www.awaresystems.be/imaging/tiff/tifftags/geo_metadata.html>`__:
- `GEO_METADATA <https://portal.dgiwg.org/files/70843>`__:
This tag may be used for embedding XML-encoded instance documents
prepared using 19139-based schema (GeoTIFF DGIWG) (GDAL >= 2.3)
- `TIFF_RSID <https://www.awaresystems.be/imaging/tiff/tifftags/tiff_rsid.html>`__:
Expand Down
2 changes: 2 additions & 0 deletions frmts/libertiff/libertiffdataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1403,6 +1403,8 @@ bool LIBERTIFFDataset::ReadBlock(GByte *pabyBlockData, int nBlockXOff,

if (tlsState.m_tiff.tif_decodestrip)
{
tlsState.m_tiff.tif_name =
const_cast<char *>(GetDescription());
tlsState.m_tiff.tif_dir.td_sampleformat =
static_cast<uint16_t>(m_image->sampleFormat());
tlsState.m_tiff.tif_dir.td_bitspersample =
Expand Down
Loading
Loading