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 #138

Merged
merged 6 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
9 changes: 9 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 Expand Up @@ -2173,6 +2175,13 @@ bool LIBERTIFFDataset::Open(std::unique_ptr<const LIBERTIFF_NS::Image> image)
}

const GDALDataType eDT = ComputeGDALDataType();
if (eDT == GDT_Unknown)
{
CPLDebug("LIBERTIFF",
"BitsPerSample = %u and SampleFormat=%u unhandled",
m_image->bitsPerSample(), m_image->sampleFormat());
return false;
}

// Deal with Predictor tag
if (m_image->predictor() == 2)
Expand Down
Loading
Loading