Refs #23804 -- Improved value validation in GDALRaster.geotransform setter.

This commit is contained in:
Adam Johnson 2017-05-30 15:02:50 +02:00 committed by Tim Graham
parent 037d6540ec
commit 9509268cea
2 changed files with 16 additions and 1 deletions

View file

@ -250,7 +250,7 @@ class GDALRaster(GDALBase):
@geotransform.setter
def geotransform(self, values):
"Set the geotransform for the data source."
if sum([isinstance(x, (int, float)) for x in values]) != 6:
if len(values) != 6 or not all(isinstance(x, (int, float)) for x in values):
raise ValueError('Geotransform must consist of 6 numeric values.')
# Create ctypes double array with input and write data
values = (c_double * 6)(*values)