Skip to content

Commit b01cd82

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents ef70707 + 7b610c0 commit b01cd82

File tree

98 files changed

+4281
-444
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+4281
-444
lines changed

NEWS.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,97 @@
1+
# GDAL/OGR 3.11.3 Release Notes
2+
3+
GDAL 3.11.3 is a bugfix release.
4+
5+
PG driver:
6+
* restore string truncation that was broken in 3.11.1
7+
8+
# GDAL/OGR 3.11.2 Release Notes
9+
10+
GDAL 3.11.2 is a bugfix release.
11+
12+
## Build
13+
14+
* sqlite_rtree_bulk_load.c: add missing stdlib.h include
15+
16+
## GDAL 3.11.2
17+
18+
### Port
19+
20+
* Unix/Win32/Sparse/Archive VSI: make sure that Close() can be called multiple
21+
times, and is called by destructor
22+
* /vsizip/: fix memory leak when opening a SOZip-enabled file (pyogrio#545)
23+
24+
### Core
25+
26+
* GDALAlgorithmArg::Serialize(): fix serialization of list arguments with
27+
SetPackedValuesAllowed(false)
28+
* GetHistogram(), ComputeRasterMinMax(), ComputeStatistics(): fix wrong use of
29+
GetLockedBlockRef() that could cause crashes with the MEM driver
30+
* Statistics computation: avoid warnings with large Int64/UInt64 nodata value
31+
not exactly representable as double (#12628)
32+
33+
### Raster utilities
34+
35+
* gdalwarp: fix reprojecting to COG (3.11.0 regression)
36+
* gdallocationinfo: handle properly nodata values (3.10.0 regression fix)
37+
38+
### Raster drivers
39+
40+
AAIGrid/GRASSASCII/ISG drivers:
41+
* avoid excessive memory allocation on truncated/corrupted/hostile file
42+
(#12648)
43+
44+
BMP driver:
45+
* Create(): avoid nullptr dereference on too wide image
46+
47+
GSAG driver:
48+
* re-added (#12695)
49+
50+
GSBG/GS7BG drivers:
51+
* Create/CreateCopy(): stricter validation of raster dimension, to avoid int
52+
overflow (GS7BG), or floating-point division by zero (both)
53+
54+
LIBERTIFF driver:
55+
* fix reading WEBP-compressed RGBA images where at least one tile/
56+
strip has the alpha component omitted due to being fully opaque
57+
58+
netCDF driver:
59+
* properly recognize axis of 'rhos' variable for PACE OCI products
60+
* improve detection of X,Y axis in 3D variables thanks to the presence of a
61+
geolocation array
62+
63+
PNG driver:
64+
* fix caching of other bands that only worked if reading band 1 (#12713)
65+
66+
VRT driver:
67+
* expose all overviews of a single-source dataset, whatever their size
68+
(#12690)
69+
* VRTPansharpen: make virtual overview generation more tolerant to different
70+
number of overviews in source bands
71+
72+
## OGR 3.11.2
73+
74+
### Core
75+
76+
* OGRParseDate(): do not round second=59.999999 to 60.0 but 59.999
77+
* OGRParseDate(): avoid potential out-of-bounds read in OGRPARSEDATE_OPTION_LAX
78+
mode (#12720)
79+
80+
### OGRSpatialReference
81+
82+
* Coordinate transformation: fix when one of the CRS has an EPSG code that is
83+
actually a ESRI one
84+
85+
### Vector utilities
86+
87+
* ogrinfo/ogr2ogr/gdal vector sql/etc.: raise the max size of a @filename
88+
argument from 1 MB to 10 MB (#12672)
89+
90+
### Vector drivers
91+
92+
S57 driver:
93+
* fix nullptr dereference on invalid dataset when GDAL_DATA not set
94+
195
# GDAL/OGR 3.11.1 Release Notes
296

397
GDAL 3.11.1 is a bugfix release.

apps/gdal_grid_lib.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,20 +1280,13 @@ GDALGridOptionsNew(char **papszArgv,
12801280

12811281
if (auto oSpat = argParser->present<std::vector<double>>("-spat"))
12821282
{
1283-
OGRLinearRing oRing;
12841283
const double dfMinX = (*oSpat)[0];
12851284
const double dfMinY = (*oSpat)[1];
12861285
const double dfMaxX = (*oSpat)[2];
12871286
const double dfMaxY = (*oSpat)[3];
12881287

1289-
oRing.addPoint(dfMinX, dfMinY);
1290-
oRing.addPoint(dfMinX, dfMaxY);
1291-
oRing.addPoint(dfMaxX, dfMaxY);
1292-
oRing.addPoint(dfMaxX, dfMinY);
1293-
oRing.addPoint(dfMinX, dfMinY);
1294-
1295-
auto poPolygon = std::make_unique<OGRPolygon>();
1296-
poPolygon->addRing(&oRing);
1288+
auto poPolygon =
1289+
std::make_unique<OGRPolygon>(dfMinX, dfMinY, dfMaxX, dfMaxY);
12971290
psOptions->poSpatialFilter = std::move(poPolygon);
12981291
}
12991292

apps/gdalgetgdalpath.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,21 +139,21 @@ std::string GDALGetGDALPath()
139139
CPLAssert(fpOut);
140140
CPLSpawn(apszArgv, nullptr, fpOut.get(), /* bDisplayErr = */ false);
141141
const auto nPos = fpOut->Tell();
142-
char szVersion[128] = {0};
143-
if (nPos > 0 && nPos < sizeof(szVersion))
142+
std::string osVersion;
143+
osVersion.resize(128);
144+
if (nPos > 0 && nPos < osVersion.size())
144145
{
145-
size_t nVersionSize = static_cast<size_t>(nPos);
146+
osVersion.resize(static_cast<size_t>(nPos));
146147
fpOut->Seek(0, SEEK_SET);
147-
fpOut->Read(szVersion, 1, nVersionSize);
148+
fpOut->Read(osVersion.data(), 1, osVersion.size());
148149
for (const char ch : {'\n', '\r'})
149150
{
150-
if (nVersionSize >= 1 && szVersion[nVersionSize - 1] == ch)
151+
if (!osVersion.empty() && osVersion.back() == ch)
151152
{
152-
szVersion[nVersionSize - 1] = 0;
153-
--nVersionSize;
153+
osVersion.pop_back();
154154
}
155155
}
156-
if (strcmp(szVersion, GDALVersionInfo("")) == 0)
156+
if (osVersion == GDALVersionInfo(""))
157157
{
158158
return osPath;
159159
}
@@ -164,7 +164,7 @@ std::string GDALGetGDALPath()
164164
"expected. Make sure the gdal binary corresponding "
165165
"to the version of the libgdal of the current "
166166
"process is in the PATH environment variable",
167-
osPath.c_str(), szVersion, GDALVersionInfo(""));
167+
osPath.c_str(), osVersion.c_str(), GDALVersionInfo(""));
168168
}
169169
}
170170
else

apps/gdallocationinfo.cpp

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -577,11 +577,25 @@ MAIN_START(argc, argv)
577577
const bool bIsComplex = CPL_TO_BOOL(
578578
GDALDataTypeIsComplex(GDALGetRasterDataType(hBand)));
579579

580-
CPLErr err;
581-
err = GDALRasterInterpolateAtPoint(hBand, dfPixelToQuery,
582-
dfLineToQuery, eInterpolation,
583-
&adfPixel[0], &adfPixel[1]);
584-
580+
CPLErrorReset();
581+
CPLErr err = GDALRasterInterpolateAtPoint(
582+
hBand, dfPixelToQuery, dfLineToQuery, eInterpolation,
583+
&adfPixel[0], &adfPixel[1]);
584+
585+
// GDALRasterInterpolateAtPoint() returns false on nodata
586+
bool bIsNoData = false;
587+
if (err != CE_None && CPLGetLastErrorType() == CE_None)
588+
{
589+
int bHasNoData = FALSE;
590+
const double dfNoData =
591+
GDALGetRasterNoDataValue(hBand, &bHasNoData);
592+
if (bHasNoData)
593+
{
594+
bIsNoData = true;
595+
adfPixel[0] = adfPixel[1] = dfNoData;
596+
err = CE_None;
597+
}
598+
}
585599
if (err == CE_None)
586600
{
587601
CPLString osValue;
@@ -628,7 +642,7 @@ MAIN_START(argc, argv)
628642
"Unable to get raster scale." );
629643
}
630644
#endif
631-
if (dfOffset != 0.0 || dfScale != 1.0)
645+
if (!bIsNoData && (dfOffset != 0.0 || dfScale != 1.0))
632646
{
633647
adfPixel[0] = adfPixel[0] * dfScale + dfOffset;
634648

@@ -651,7 +665,19 @@ MAIN_START(argc, argv)
651665
printf(" Descaled Value: %s\n", osValue.c_str());
652666
}
653667
}
654-
668+
else
669+
{
670+
nRetCode = 1;
671+
if (bAsXML)
672+
{
673+
osXML += "<IOError/>";
674+
}
675+
else if (bValOnly)
676+
{
677+
if (i > 0)
678+
printf("%s", osFieldSep.c_str());
679+
}
680+
}
655681
if (bAsXML)
656682
osXML += "</BandReport>";
657683
}

apps/gdalwarp_lib.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ static GDALDatasetH GDALWarpCreateOutput(
255255
int nSrcCount, GDALDatasetH *pahSrcDS, const char *pszFilename,
256256
const char *pszFormat, char **papszTO, CSLConstList papszCreateOptions,
257257
GDALDataType eDT, GDALTransformerArgUniquePtr &hTransformArg,
258-
bool bSetColorInterpretation, GDALWarpAppOptions *psOptions);
258+
bool bSetColorInterpretation, GDALWarpAppOptions *psOptions,
259+
bool bUpdateTransformerWithDestGT);
259260

260261
static void RemoveConflictingMetadata(GDALMajorObjectH hObj,
261262
CSLConstList papszMetadata,
@@ -1161,17 +1162,18 @@ static bool DealWithCOGOptions(CPLStringList &aosCreateOptions, int nSrcCount,
11611162
return true;
11621163
};
11631164

1165+
CPLString osTargetSRS;
1166+
if (COGGetTargetSRS(aosCreateOptions.List(), osTargetSRS))
1167+
{
1168+
if (!SetDstSRS(osTargetSRS))
1169+
return false;
1170+
}
1171+
11641172
if (!(psOptions->dfMinX == 0 && psOptions->dfMinY == 0 &&
11651173
psOptions->dfMaxX == 0 && psOptions->dfMaxY == 0 &&
11661174
psOptions->dfXRes == 0 && psOptions->dfYRes == 0 &&
11671175
psOptions->nForcePixels == 0 && psOptions->nForceLines == 0))
11681176
{
1169-
CPLString osTargetSRS;
1170-
if (COGGetTargetSRS(aosCreateOptions.List(), osTargetSRS))
1171-
{
1172-
if (!SetDstSRS(osTargetSRS))
1173-
return false;
1174-
}
11751177
if (!psOptions->bResampleAlgSpecifiedByUser && nSrcCount > 0)
11761178
{
11771179
GDALGetWarpResampleAlg(
@@ -1196,15 +1198,14 @@ static bool DealWithCOGOptions(CPLStringList &aosCreateOptions, int nSrcCount,
11961198
nSrcCount, pahSrcDS, osTmpFilename, "GTiff",
11971199
oClonedOptions.aosTransformerOptions.List(),
11981200
aosTmpGTiffCreateOptions.List(), oClonedOptions.eOutputType,
1199-
hUniqueTransformArg, false, &oClonedOptions);
1200-
1201+
hUniqueTransformArg, false, &oClonedOptions,
1202+
/* bUpdateTransformerWithDestGT = */ false);
12011203
if (hTmpDS == nullptr)
12021204
{
12031205
return false;
12041206
}
12051207

12061208
CPLString osResampling;
1207-
CPLString osTargetSRS;
12081209
int nXSize = 0;
12091210
int nYSize = 0;
12101211
double dfMinX = 0;
@@ -1219,8 +1220,6 @@ static bool DealWithCOGOptions(CPLStringList &aosCreateOptions, int nSrcCount,
12191220
{
12201221
if (!psOptions->bResampleAlgSpecifiedByUser)
12211222
GDALGetWarpResampleAlg(osResampling, psOptions->eResampleAlg);
1222-
if (!SetDstSRS(osTargetSRS))
1223-
bRet = false;
12241223
psOptions->dfMinX = dfMinX;
12251224
psOptions->dfMinY = dfMinY;
12261225
psOptions->dfMaxX = dfMaxX;
@@ -1742,7 +1741,8 @@ CreateOutput(const char *pszDest, int nSrcCount, GDALDatasetH *pahSrcDS,
17421741
nSrcCount, pahSrcDS, pszDest, psOptions->osFormat.c_str(),
17431742
psOptions->aosTransformerOptions.List(),
17441743
psOptions->aosCreateOptions.List(), psOptions->eOutputType,
1745-
hUniqueTransformArg, psOptions->bSetColorInterpretation, psOptions);
1744+
hUniqueTransformArg, psOptions->bSetColorInterpretation, psOptions,
1745+
/* bUpdateTransformerWithDestGT = */ true);
17461746
if (hDstDS == nullptr)
17471747
{
17481748
return nullptr;
@@ -3507,7 +3507,8 @@ static GDALDatasetH GDALWarpCreateOutput(
35073507
int nSrcCount, GDALDatasetH *pahSrcDS, const char *pszFilename,
35083508
const char *pszFormat, char **papszTO, CSLConstList papszCreateOptions,
35093509
GDALDataType eDT, GDALTransformerArgUniquePtr &hUniqueTransformArg,
3510-
bool bSetColorInterpretation, GDALWarpAppOptions *psOptions)
3510+
bool bSetColorInterpretation, GDALWarpAppOptions *psOptions,
3511+
bool bUpdateTransformerWithDestGT)
35113512

35123513
{
35133514
GDALDriverH hDriver;
@@ -4855,7 +4856,7 @@ static GDALDatasetH GDALWarpCreateOutput(
48554856
adfDstGeoTransform[5] = fabs(adfDstGeoTransform[5]);
48564857
}
48574858

4858-
if (hUniqueTransformArg)
4859+
if (hUniqueTransformArg && bUpdateTransformerWithDestGT)
48594860
{
48604861
GDALSetGenImgProjTransformerDstGeoTransform(hUniqueTransformArg.get(),
48614862
adfDstGeoTransform);

apps/ogr2ogr_lib.cpp

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8608,20 +8608,13 @@ GDALVectorTranslateOptions *GDALVectorTranslateOptionsNew(
86088608

86098609
if (auto oSpat = argParser->present<std::vector<double>>("-spat"))
86108610
{
8611-
OGRLinearRing oRing;
86128611
const double dfMinX = (*oSpat)[0];
86138612
const double dfMinY = (*oSpat)[1];
86148613
const double dfMaxX = (*oSpat)[2];
86158614
const double dfMaxY = (*oSpat)[3];
86168615

8617-
oRing.addPoint(dfMinX, dfMinY);
8618-
oRing.addPoint(dfMinX, dfMaxY);
8619-
oRing.addPoint(dfMaxX, dfMaxY);
8620-
oRing.addPoint(dfMaxX, dfMinY);
8621-
oRing.addPoint(dfMinX, dfMinY);
8622-
8623-
auto poSpatialFilter = std::make_shared<OGRPolygon>();
8624-
poSpatialFilter->addRing(&oRing);
8616+
auto poSpatialFilter =
8617+
std::make_shared<OGRPolygon>(dfMinX, dfMinY, dfMaxX, dfMaxY);
86258618
psOptions->poSpatialFilter = poSpatialFilter;
86268619
}
86278620

@@ -8695,17 +8688,9 @@ GDALVectorTranslateOptions *GDALVectorTranslateOptionsNew(
86958688
const double dfMaxX = CPLAtofM((*oClipDst)[2].c_str());
86968689
const double dfMaxY = CPLAtofM((*oClipDst)[3].c_str());
86978690

8698-
OGRLinearRing oRing;
8699-
8700-
oRing.addPoint(dfMinX, dfMinY);
8701-
oRing.addPoint(dfMinX, dfMaxY);
8702-
oRing.addPoint(dfMaxX, dfMaxY);
8703-
oRing.addPoint(dfMaxX, dfMinY);
8704-
oRing.addPoint(dfMinX, dfMinY);
8705-
8706-
auto poPoly = std::make_shared<OGRPolygon>();
8691+
auto poPoly = std::make_shared<OGRPolygon>(dfMinX, dfMinY,
8692+
dfMaxX, dfMaxY);
87078693
psOptions->poClipDst = poPoly;
8708-
poPoly->addRing(&oRing);
87098694
}
87108695
else if ((STARTS_WITH_CI(osVal.c_str(), "POLYGON") ||
87118696
STARTS_WITH_CI(osVal.c_str(), "MULTIPOLYGON")) &&

apps/ogrinfo_lib.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2584,20 +2584,13 @@ GDALVectorInfoOptionsNew(char **papszArgv,
25842584

25852585
if (auto oSpat = argParser->present<std::vector<double>>("-spat"))
25862586
{
2587-
OGRLinearRing oRing;
25882587
const double dfMinX = (*oSpat)[0];
25892588
const double dfMinY = (*oSpat)[1];
25902589
const double dfMaxX = (*oSpat)[2];
25912590
const double dfMaxY = (*oSpat)[3];
25922591

2593-
oRing.addPoint(dfMinX, dfMinY);
2594-
oRing.addPoint(dfMinX, dfMaxY);
2595-
oRing.addPoint(dfMaxX, dfMaxY);
2596-
oRing.addPoint(dfMaxX, dfMinY);
2597-
oRing.addPoint(dfMinX, dfMinY);
2598-
2599-
auto poPolygon = std::make_unique<OGRPolygon>();
2600-
poPolygon->addRing(&oRing);
2592+
auto poPolygon =
2593+
std::make_unique<OGRPolygon>(dfMinX, dfMinY, dfMaxX, dfMaxY);
26012594
psOptions->poSpatialFilter.reset(poPolygon.release());
26022595
}
26032596

0 commit comments

Comments
 (0)