public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/gdal] f44: Backport fix for CVE-2026-49014
@ 2026-10-17 18:19 Sandro Mani
0 siblings, 0 replies; only message in thread
From: Sandro Mani @ 2026-10-17 18:19 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/gdal
Branch : f44
Commit : 06bc8254b628df9d77d9ce543ee71ac0cab716b7
Author : Sandro Mani <manisandro@gmail.com>
Date : 2026-10-17T20:19:24+02:00
Stats : +469/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/gdal/c/06bc8254b628df9d77d9ce543ee71ac0cab716b7?branch=f44
Log:
Backport fix for CVE-2026-49014
---
diff --git a/50eea7456d83c9586f112ef96b43249372839dea.patch b/50eea7456d83c9586f112ef96b43249372839dea.patch
new file mode 100644
index 0000000..60f3330
--- /dev/null
+++ b/50eea7456d83c9586f112ef96b43249372839dea.patch
@@ -0,0 +1,463 @@
+diff -rupN --no-dereference gdal-3.12.4-fedora/frmts/netcdf/netcdfdataset.cpp gdal-3.12.4-fedora-new/frmts/netcdf/netcdfdataset.cpp
+--- gdal-3.12.4-fedora/frmts/netcdf/netcdfdataset.cpp 2026-04-24 14:05:58.000000000 +0200
++++ gdal-3.12.4-fedora-new/frmts/netcdf/netcdfdataset.cpp 2026-10-17 19:11:55.064592784 +0200
+@@ -3985,50 +3985,38 @@ void netCDFDataset::SetProjectionFromVar
+ {
+ if (EQUAL(pszProjName, SRS_PT_GEOSTATIONARY_SATELLITE))
+ {
+- double satelliteHeight =
++ const double satelliteHeight =
+ oSRS.GetProjParm(SRS_PP_SATELLITE_HEIGHT, 1.0);
+- size_t nAttlen = 0;
+- char szUnits[NC_MAX_NAME + 1];
+- szUnits[0] = '\0';
+- nc_type nAttype = NC_NAT;
+- nc_inq_att(nGroupId, nVarDimXID, "units", &nAttype,
+- &nAttlen);
+- if (nAttlen < sizeof(szUnits) &&
+- nc_get_att_text(nGroupId, nVarDimXID, "units",
+- szUnits) == NC_NOERR)
++ std::string osUnits;
++ if (NCDFGetAttr(nGroupId, nVarDimXID, "units", osUnits) ==
++ CE_None)
+ {
+- szUnits[nAttlen] = '\0';
+- if (EQUAL(szUnits, "microradian"))
++ if (EQUAL(osUnits.c_str(), "microradian"))
+ {
+ xMinMax[0] =
+ xMinMax[0] * satelliteHeight * 0.000001;
+ xMinMax[1] =
+ xMinMax[1] * satelliteHeight * 0.000001;
+ }
+- else if (EQUAL(szUnits, "rad") ||
+- EQUAL(szUnits, "radian"))
++ else if (EQUAL(osUnits.c_str(), "rad") ||
++ EQUAL(osUnits.c_str(), "radian"))
+ {
+ xMinMax[0] = xMinMax[0] * satelliteHeight;
+ xMinMax[1] = xMinMax[1] * satelliteHeight;
+ }
+ }
+- szUnits[0] = '\0';
+- nc_inq_att(nGroupId, nVarDimYID, "units", &nAttype,
+- &nAttlen);
+- if (nAttlen < sizeof(szUnits) &&
+- nc_get_att_text(nGroupId, nVarDimYID, "units",
+- szUnits) == NC_NOERR)
++ if (NCDFGetAttr(nGroupId, nVarDimYID, "units", osUnits) ==
++ CE_None)
+ {
+- szUnits[nAttlen] = '\0';
+- if (EQUAL(szUnits, "microradian"))
++ if (EQUAL(osUnits.c_str(), "microradian"))
+ {
+ yMinMax[0] =
+ yMinMax[0] * satelliteHeight * 0.000001;
+ yMinMax[1] =
+ yMinMax[1] * satelliteHeight * 0.000001;
+ }
+- else if (EQUAL(szUnits, "rad") ||
+- EQUAL(szUnits, "radian"))
++ else if (EQUAL(osUnits.c_str(), "rad") ||
++ EQUAL(osUnits.c_str(), "radian"))
+ {
+ yMinMax[0] = yMinMax[0] * satelliteHeight;
+ yMinMax[1] = yMinMax[1] * satelliteHeight;
+@@ -5192,8 +5180,7 @@ int NCDFWriteSRSVariable(int cdfid, cons
+ break;
+ }
+ std::string val;
+- val.resize(attlen);
+- nc_get_att_text(cdfid, NCDFVarID, szAttrName, &val[0]);
++ NCDFGetAttr(cdfid, NCDFVarID, szAttrName, val);
+ if (val != pszValue)
+ {
+ bSame = false;
+@@ -6532,10 +6519,8 @@ CPLErr netCDFDataset::ReadAttributes(int
+ /************************************************************************/
+ void netCDFDataset::CreateSubDatasetList(int nGroupId)
+ {
+- char szVarStdName[NC_MAX_NAME + 1];
++ std::string osVarStdName;
+ int *ponDimIds = nullptr;
+- nc_type nAttype;
+- size_t nAttlen;
+
+ netCDFDataset *poDS = this;
+
+@@ -6616,17 +6601,10 @@ void netCDFDataset::CreateSubDatasetList
+
+ nSubDatasets++;
+
+- nAttlen = 0;
+- nc_inq_att(nGroupId, nVar, CF_STD_NAME, &nAttype, &nAttlen);
+- if (nAttlen < sizeof(szVarStdName) &&
+- nc_get_att_text(nGroupId, nVar, CF_STD_NAME, szVarStdName) ==
+- NC_NOERR)
+- {
+- szVarStdName[nAttlen] = '\0';
+- }
+- else
++ if (NCDFGetAttr(nGroupId, nVar, CF_STD_NAME, osVarStdName) !=
++ CE_None)
+ {
+- snprintf(szVarStdName, sizeof(szVarStdName), "%s", pszName);
++ osVarStdName = pszName;
+ }
+
+ char szTemp[NC_MAX_NAME + 1];
+@@ -6656,7 +6634,7 @@ void netCDFDataset::CreateSubDatasetList
+ poDS->papszSubDatasets =
+ CSLSetNameValue(poDS->papszSubDatasets, szTemp,
+ CPLSPrintf("[%s] %s (%s)", osDim.c_str(),
+- szVarStdName, pszType));
++ osVarStdName.c_str(), pszType));
+ }
+ }
+
+@@ -8471,22 +8449,12 @@ GDALDataset *netCDFDataset::Open(GDALOpe
+ }
+ }
+
+- char szConventions[NC_MAX_NAME + 1];
+- szConventions[0] = '\0';
+- nc_type nAttype = NC_NAT;
+- size_t nAttlen = 0;
+- nc_inq_att(cdfid, NC_GLOBAL, "Conventions", &nAttype, &nAttlen);
+- if (nAttlen >= sizeof(szConventions) ||
+- nc_get_att_text(cdfid, NC_GLOBAL, "Conventions", szConventions) !=
+- NC_NOERR)
++ std::string osConventions;
++ if (NCDFGetAttr(cdfid, NC_GLOBAL, "Conventions", osConventions) != CE_None)
+ {
+ CPLDebug("GDAL_netCDF", "No UNIDATA NC_GLOBAL:Conventions attribute");
+ // Note that 'Conventions' is always capital 'C' in CF spec.
+ }
+- else
+- {
+- szConventions[nAttlen] = '\0';
+- }
+
+ // Create band information objects.
+ CPLDebug("GDAL_netCDF", "var_count = %d", nvars);
+@@ -8661,7 +8629,7 @@ GDALDataset *netCDFDataset::Open(GDALOpe
+ // attributes (not varnames) set GDAL_NETCDF_VERIFY_DIMS=STRICT
+ const bool bCheckDims =
+ CPLTestBool(CPLGetConfigOption("GDAL_NETCDF_VERIFY_DIMS", "YES")) &&
+- STARTS_WITH_CI(szConventions, "CF");
++ STARTS_WITH_CI(osConventions.c_str(), "CF");
+
+ bool bYXBandOrder = false;
+ if (nd == 3)
+@@ -10870,6 +10838,35 @@ CPLErr NCDFGetAttr(int nCdfId, int nVarI
+ return NCDFGetAttr1(nCdfId, nVarId, pszAttrName, nullptr, pszValue);
+ }
+
++CPLErr NCDFGetAttr(int nCdfId, int nVarId, const char *pszAttrName,
++ std::string &osValue)
++{
++ nc_type nAttrType = NC_NAT;
++ size_t nAttrLen = 0;
++
++ int status = nc_inq_att(nCdfId, nVarId, pszAttrName, &nAttrType, &nAttrLen);
++ if (status != NC_NOERR)
++ return CE_Failure;
++
++ if (nAttrType != NC_CHAR)
++ return CE_Failure;
++
++ try
++ {
++ osValue.resize(nAttrLen, 0);
++ }
++ catch (const std::exception &)
++ {
++ return CE_Failure;
++ }
++
++ const auto nErr = nc_get_att_text(nCdfId, nVarId, pszAttrName,
++ osValue.data()) != NC_NOERR;
++ NCDF_ERR_RET(nErr);
++
++ return CE_None;
++}
++
+ /* By default write NC_CHAR, but detect for int/float/double and */
+ /* NC4 string arrays */
+ static CPLErr NCDFPutAttr(int nCdfId, int nVarId, const char *pszAttrName,
+@@ -12430,13 +12427,13 @@ CPLErr netCDFDataset::FilterVars(
+ &attlen) == NC_NOERR &&
+ atttype == NC_CHAR && attlen < NC_MAX_NAME)
+ {
+- char szInstanceDimension[NC_MAX_NAME + 1];
+- if (nc_get_att_text(nCdfId, v, "instance_dimension",
+- szInstanceDimension) == NC_NOERR)
+- {
+- szInstanceDimension[attlen] = 0;
+- int status = nc_inq_dimid(nCdfId, szInstanceDimension,
+- &nProfileDimId);
++ std::string osInstanceDimension;
++ if (NCDFGetAttr(nCdfId, v, "instance_dimension",
++ osInstanceDimension) == CE_None)
++ {
++ const int status =
++ nc_inq_dimid(nCdfId, osInstanceDimension.c_str(),
++ &nProfileDimId);
+ if (status == NC_NOERR)
+ nParentIndexVarID = v;
+ else
+@@ -12445,7 +12442,7 @@ CPLErr netCDFDataset::FilterVars(
+ CPLError(CE_Warning, CPLE_AppDefined,
+ "Attribute instance_dimension='%s' refers "
+ "to a non existing dimension",
+- szInstanceDimension);
++ osInstanceDimension.c_str());
+ else
+ NCDF_ERR(status);
+ }
+diff -rupN --no-dereference gdal-3.12.4-fedora/frmts/netcdf/netcdfdataset.h gdal-3.12.4-fedora-new/frmts/netcdf/netcdfdataset.h
+--- gdal-3.12.4-fedora/frmts/netcdf/netcdfdataset.h 2026-04-24 14:05:58.000000000 +0200
++++ gdal-3.12.4-fedora-new/frmts/netcdf/netcdfdataset.h 2026-10-17 19:11:55.065991462 +0200
+@@ -793,6 +793,8 @@ CPLErr NCDFGetAttr(int nCdfId, int nVarI
+ double *pdfValue);
+ CPLErr NCDFGetAttr(int nCdfId, int nVarId, const char *pszAttrName,
+ char **pszValue);
++CPLErr NCDFGetAttr(int nCdfId, int nVarId, const char *pszAttrName,
++ std::string &osValue);
+ bool NCDFIsUnlimitedDim(bool bIsNC4, int cdfid, int nDimId);
+ bool NCDFIsUserDefinedType(int ncid, int type);
+
+diff -rupN --no-dereference gdal-3.12.4-fedora/frmts/netcdf/netcdfsg.cpp gdal-3.12.4-fedora-new/frmts/netcdf/netcdfsg.cpp
+--- gdal-3.12.4-fedora/frmts/netcdf/netcdfsg.cpp 2026-04-24 14:05:58.000000000 +0200
++++ gdal-3.12.4-fedora-new/frmts/netcdf/netcdfsg.cpp 2026-10-17 19:11:55.066423204 +0200
+@@ -19,36 +19,6 @@
+
+ namespace nccfdriver
+ {
+-/* Attribute Fetch
+- * -
+- * A function which makes it a bit easier to fetch single text attribute values
+- * ncid: as used in netcdf.h
+- * varID: variable id in which to look for the attribute
+- * attrName: name of attribute to fine
+- * alloc: a reference to a string that will be filled with the attribute (i.e.
+- * truncated and filled with the return value) Returns: a reference to the
+- * string to fill (a.k.a. string pointed to by alloc reference)
+- */
+-std::string &attrf(int ncid, int varId, const char *attrName,
+- std::string &alloc)
+-{
+- size_t len = 0;
+- nc_inq_attlen(ncid, varId, attrName, &len);
+-
+- if (len < 1)
+- {
+- alloc.clear();
+- return alloc;
+- }
+-
+- alloc.resize(len);
+- memset(&alloc[0], 0, len);
+-
+- // Now look through this variable for the attribute
+- nc_get_att_text(ncid, varId, attrName, &alloc[0]);
+-
+- return alloc;
+-}
+
+ /* SGeometry_Reader
+ * (implementations)
+@@ -82,7 +52,8 @@ SGeometry_Reader::SGeometry_Reader(int n
+
+ // Get grid mapping variable, if it exists
+ this->gm_varId = INVALID_VAR_ID;
+- if (attrf(ncId, geoVarId, CF_GRD_MAPPING, gm_name_s) != "")
++ if (NCDFGetAttr(ncId, geoVarId, CF_GRD_MAPPING, gm_name_s) == CE_None &&
++ !gm_name_s.empty())
+ {
+ const char *gm_name = gm_name_s.c_str();
+ int gmVID;
+@@ -103,7 +74,9 @@ SGeometry_Reader::SGeometry_Reader(int n
+ size_t bound = 0;
+ size_t total_node_count = 0; // used in error checks later
+ size_t total_part_node_count = 0;
+- if (attrf(ncId, geoVarId, CF_SG_NODE_COUNT, nc_name_s) != "")
++
++ if (NCDFGetAttr(ncId, geoVarId, CF_SG_NODE_COUNT, nc_name_s) == CE_None &&
++ !nc_name_s.empty())
+ {
+ const char *nc_name = nc_name_s.c_str();
+ nc_inq_varid(ncId, nc_name, &nc_vid);
+@@ -122,7 +95,9 @@ SGeometry_Reader::SGeometry_Reader(int n
+ }
+ }
+
+- if (attrf(ncId, geoVarId, CF_SG_PART_NODE_COUNT, pnc_name_s) != "")
++ if (NCDFGetAttr(ncId, geoVarId, CF_SG_PART_NODE_COUNT, pnc_name_s) ==
++ CE_None &&
++ !pnc_name_s.empty())
+ {
+ const char *pnc_name = pnc_name_s.c_str();
+ bound = 0;
+@@ -142,7 +117,9 @@ SGeometry_Reader::SGeometry_Reader(int n
+ }
+ }
+
+- if (attrf(ncId, geoVarId, CF_SG_INTERIOR_RING, ir_name_s) != "")
++ if (NCDFGetAttr(ncId, geoVarId, CF_SG_INTERIOR_RING, ir_name_s) ==
++ CE_None &&
++ !ir_name_s.empty())
+ {
+ const char *ir_name = ir_name_s.c_str();
+ bound = 0;
+@@ -230,7 +207,9 @@ SGeometry_Reader::SGeometry_Reader(int n
+
+ std::string cart_s;
+ // Node Coordinates
+- if (attrf(ncId, geoVarId, CF_SG_NODE_COORDINATES, cart_s) == "")
++ if (NCDFGetAttr(ncId, geoVarId, CF_SG_NODE_COORDINATES, cart_s) !=
++ CE_None ||
++ cart_s.empty())
+ {
+ throw SG_Exception_Existential(container_name, CF_SG_NODE_COORDINATES);
+ }
+@@ -292,7 +271,7 @@ SGeometry_Reader::SGeometry_Reader(int n
+
+ // Check axis signature
+ std::string a_sig;
+- attrf(ncId, axis_id, CF_AXIS, a_sig);
++ NCDFGetAttr(ncId, axis_id, CF_AXIS, a_sig);
+
+ // If valid signify axis correctly
+ if (a_sig == "X")
+@@ -765,43 +744,30 @@ void SGeometry_PropertyScanner::open(int
+ return;
+ }
+
++ std::string buf;
+ for (int curr = 0; curr < varCount; curr++)
+ {
+- size_t contname2_len = 0;
+-
+- // First find container length, and make buf that size in chars
+- if (nc_inq_attlen(this->nc, curr, CF_SG_GEOMETRY, &contname2_len) !=
+- NC_NOERR)
+- {
+- // not a geometry variable, continue
+- continue;
+- }
+-
+- // Also if present but empty, go on
+- if (contname2_len == 0)
+- continue;
+-
+- // Otherwise, geometry: see what container it has
+- char buf[NC_MAX_CHAR + 1];
+- memset(buf, 0, NC_MAX_CHAR + 1);
+-
+- if (nc_get_att_text(this->nc, curr, CF_SG_GEOMETRY, buf) != NC_NOERR)
++ if (NCDFGetAttr(this->nc, curr, CF_SG_GEOMETRY, buf) != CE_None ||
++ buf.empty())
+ {
+ continue;
+ }
+
+ // If matches, then establish a reference by placing this variable's
+ // data in both vectors
+- if (!strcmp(contname, buf))
++ if (!strcmp(contname, buf.c_str()))
+ {
+- char property_name[NC_MAX_NAME + 1] = {0};
++ std::string property_name;
+
+ // look for special OGR original name field
+- if (nc_get_att_text(this->nc, curr, OGR_SG_ORIGINAL_LAYERNAME,
+- property_name) != NC_NOERR)
++ if (NCDFGetAttr(this->nc, curr, OGR_SG_ORIGINAL_LAYERNAME,
++ property_name) != CE_None)
+ {
+- // if doesn't exist, then just use the variable name
+- if (nc_inq_varname(this->nc, curr, property_name) != NC_NOERR)
++ // if it doesn't exist, then just use the variable name
++ property_name.resize(NC_MAX_NAME + 1, 0);
++
++ if (nc_inq_varname(this->nc, curr, property_name.data()) !=
++ NC_NOERR)
+ {
+ throw SG_Exception_General_Malformed(contname);
+ }
+@@ -881,7 +847,8 @@ double getCFVersion(int ncid)
+ std::string attrVal;
+
+ // Fetch the CF attribute
+- if (attrf(ncid, NC_GLOBAL, NCDF_CONVENTIONS, attrVal) == "")
++ if (NCDFGetAttr(ncid, NC_GLOBAL, NCDF_CONVENTIONS, attrVal) != CE_None ||
++ attrVal.empty())
+ {
+ return ver;
+ }
+@@ -898,16 +865,15 @@ geom_t getGeometryType(int ncid, int var
+ {
+ geom_t ret = UNSUPPORTED;
+ std::string gt_name_s;
+- const char *gt_name =
+- attrf(ncid, varid, CF_SG_GEOMETRY_TYPE, gt_name_s).c_str();
+
+- if (gt_name[0] == '\0')
++ if (NCDFGetAttr(ncid, varid, CF_SG_GEOMETRY_TYPE, gt_name_s) != CE_None ||
++ gt_name_s.empty())
+ {
+ return NONE;
+ }
+
+ // Points
+- if (!strcmp(gt_name, CF_SG_TYPE_POINT))
++ if (!strcmp(gt_name_s.c_str(), CF_SG_TYPE_POINT))
+ {
+ // Node Count not present? Assume that it is a multipoint.
+ if (nc_inq_att(ncid, varid, CF_SG_NODE_COUNT, nullptr, nullptr) ==
+@@ -920,7 +886,7 @@ geom_t getGeometryType(int ncid, int var
+ }
+
+ // Lines
+- else if (!strcmp(gt_name, CF_SG_TYPE_LINE))
++ else if (!strcmp(gt_name_s.c_str(), CF_SG_TYPE_LINE))
+ {
+ // Part Node Count present? Assume multiline
+ if (nc_inq_att(ncid, varid, CF_SG_PART_NODE_COUNT, nullptr, nullptr) ==
+@@ -933,7 +899,7 @@ geom_t getGeometryType(int ncid, int var
+ }
+
+ // Polygons
+- else if (!strcmp(gt_name, CF_SG_TYPE_POLY))
++ else if (!strcmp(gt_name_s.c_str(), CF_SG_TYPE_POLY))
+ {
+ /* Polygons versus MultiPolygons, slightly ambiguous
+ * Part Node Count & no Interior Ring - MultiPolygon
+@@ -1091,20 +1057,18 @@ int scanForGeometryContainers(int ncid,
+
+ r_ids.clear();
+
+- // For each variable check for geometry attribute
+- // If has geometry attribute, then check the associated variable ID
+-
++ // For each variable check for a geometry attribute
++ // If it has geometry attribute, then check the associated variable ID
++ std::string buf;
+ for (int itr = 0; itr < nvars; itr++)
+ {
+- char c[NC_MAX_CHAR];
+- memset(c, 0, NC_MAX_CHAR);
+- if (nc_get_att_text(ncid, itr, CF_SG_GEOMETRY, c) != NC_NOERR)
++ if (NCDFGetAttr(ncid, itr, CF_SG_GEOMETRY, buf) != CE_None)
+ {
+ continue;
+ }
+
+ int varID;
+- if (nc_inq_varid(ncid, c, &varID) != NC_NOERR)
++ if (nc_inq_varid(ncid, buf.c_str(), &varID) != NC_NOERR)
+ {
+ continue;
+ }
diff --git a/gdal.spec b/gdal.spec
index 6d3b072..8a9f2c0 100644
--- a/gdal.spec
+++ b/gdal.spec
@@ -52,7 +52,7 @@
Name: gdal
Version: 3.12.4
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: GIS file format library
License: MIT
URL: http://www.gdal.org
@@ -72,6 +72,8 @@ Source5: %{name}-cleaner.sh
# Add some utils to the default install target
Patch0: gdal_utils.patch
+# Backport fix for CVE-2026-49014
+Patch1: https://github.com/OSGeo/gdal/commit/50eea7456d83c9586f112ef96b43249372839dea.patch
BuildRequires: cmake
BuildRequires: gcc-c++
@@ -880,6 +882,9 @@ done
%changelog
+* Sat Oct 17 2026 Sandro Mani <manisandro@gmail.com> - 3.12.4-2
+- Backport fix for CVE-2026-49014
+
* Sun Apr 26 2026 Sandro Mani <manisandro@gmail.com> - 3.12.4-1
- Update to 3.12.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-17 18:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-17 18:19 [rpms/gdal] f44: Backport fix for CVE-2026-49014 Sandro Mani
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox