[gdal-dev] Crash in GEOS iterating through the layers in a PBF-file loaded with the MVT driver in GDAL 3.12.4#2

Roman Plöhn Roman.Ploehn at and-solution.com
Mon Jun 8 04:16:38 PDT 2026


Hello,

in our company we since many years use GDAL (for building C++ software for Windows only) from VCPKG.

The GDAL version used in the most recent VCPKG is 3.12.4#2, in which I encounter a reproducable crash in RELEASE builds when opening a file downloaded from a Map-Tiles server, as soon as I iterate through its layers.

My main question about this problem is if this problem is already fixed in a more recent GDAL version ... if so I could send the VCPKG-maintainers a feature request to ask them to update the GDAL package in there to a version, where it doesn't crash anymore.

Below is a description of the problem. If needed I can send the file in question.

For us this is a serioes issue, because it hinders us from using a recent version of VCPKG at all (we even use the dependend lib mapnik, which needs GDAL).

I really hope someone can help me ...

Best regards,

have a nice day,

Roman




The function I use to reproduce the crash is quite simpel:

auto GetLayerFeaureFIDs( OGRLayer& layer ) -> std::vector< GIntBig >
{
      std::cout << "Processing layer '" << layer.GetName() << "'...\n";

      std::vector< GIntBig > fids;

      OGRFeature* feature = layer.GetNextFeature();

      for ( ; feature != nullptr; feature = layer.GetNextFeature() )
      {
            if ( nullptr == feature )
            {
                  std::cout << "Got a null feature from layer '" << layer.GetName() << "'. Skipping it.\n";
                  continue;
            }

            fids.push_back( feature->GetFID() );
      }

      return fids;
}

It doesn't happen for each layer, i.e. in my DEBUG build, where no crash happens, an error is reported about a thrown TopologyException:

    Debug: GDAL: GDALOpen(C:\Projects\TestGdal\x64\Debug\43.pbf, this=000001D7A8789410) succeeds as MVT. (code: 0)
    Processing layer 'boundary'...
    Processing layer 'landcover'...
    Failure: TopologyException: side location conflict at 3934.7142857142858 3859.8571428571427. This can occur if the input geometry is invalid. (code: 1)
    Processing layer 'landuse'...
    Failure: TopologyException: side location conflict at 494.19230769230768 2796.5769230769229. This can occur if the input geometry is invalid. (code: 1)
    ...

The crash is a Access Violation, the top of the call-stack looks like this:

      [Inline Frame] geos.dll!geos::geom::CoordinateXY::equals2D(const geos::geom::CoordinateXY &) Line 106 C++
      [Inline Frame] geos.dll!geos::index::kdtree::KdTree::queryNodePoint(geos::index::kdtree::KdNode * currentNode, const geos::geom::Coordinate & odd, bool) Line 235 C++
      geos.dll!geos::index::kdtree::KdTree::query(const geos::geom::Coordinate & queryPt) Line 289    C++
      [Inline Frame] geos.dll!geos::noding::snapround::HotPixelIndex::find(const geos::geom::Coordinate &) Line 146     C++
      geos.dll!geos::noding::snapround::HotPixelIndex::addRounded(const geos::geom::CoordinateXYZM & pRound) Line 48    C++
      [Inline Frame] geos.dll!geos::noding::snapround::HotPixelIndex::add(const geos::geom::CoordinateXYZM &) Line 90   C++
      [Inline Frame] geos.dll!geos::noding::snapround::HotPixelIndex::addNodes::__l2::<lambda_8c47a75e4bac7a256ab75080e3e5d5f0>::operator()(const geos::geom::CoordinateXYZM &) Line 127  C++
      geos.dll!geos::geom::CoordinateSequence::forEach<<lambda_8c47a75e4bac7a256ab75080e3e5d5f0>>(geos::noding::snapround::HotPixelIndex::addNodes::__l2::<lambda_8c47a75e4bac7a256ab75080e3e5d5f0> && fun) Line 701    C++
      geos.dll!geos::noding::snapround::HotPixelIndex::addNodes(const geos::geom::CoordinateSequence * pts) Line 130    C++
      geos.dll!geos::noding::snapround::SnapRoundingNoder::addIntersectionPixels(std::vector<geos::noding::SegmentString *,std::allocator<geos::noding::SegmentString *>> & segStrings) Line 85 C++
      geos.dll!geos::noding::snapround::SnapRoundingNoder::snapRound(std::vector<geos::noding::SegmentString *,std::allocator<geos::noding::SegmentString *>> & inputSegStrings, std::vector<geos::noding::SegmentString *,std::allocator<geos::noding::SegmentString *>> & resultNodedSegments) Line 70    C++
      geos.dll!geos::operation::overlayng::EdgeNodingBuilder::node(std::vector<geos::noding::SegmentString *,std::allocator<geos::noding::SegmentString *>> * segStrings) Line 122  C++
      geos.dll!geos::operation::overlayng::EdgeNodingBuilder::build(const geos::geom::Geometry * geom0, const geos::geom::Geometry * geom1) Line 104  C++
      geos.dll!geos::operation::overlayng::OverlayNG::computeEdgeOverlay() Line 227 C++
      geos.dll!geos::operation::overlayng::OverlayNG::getResult() Line 195    C++
      geos.dll!geos::operation::overlayng::OverlayNG::overlay(const geos::geom::Geometry * geom0, const geos::geom::Geometry * geom1, int opCode, const geos::geom::PrecisionModel * pm) Line 100     C++
      geos.dll!geos::operation::overlayng::OverlayNGRobust::overlaySR(const geos::geom::Geometry * geom0, const geos::geom::Geometry * geom1, int opCode) Line 295      C++
      geos.dll!geos::operation::overlayng::OverlayNGRobust::Overlay(const geos::geom::Geometry * geom0, const geos::geom::Geometry * geom1, int opCode) Line 147  C++
      geos.dll!geos::geom::HeuristicOverlay(const geos::geom::Geometry * g0, const geos::geom::Geometry * g1, int opCode) Line 194  C++
      geos.dll!geos::geom::Geometry::intersection(const geos::geom::Geometry * other) Line 616  C++
      [Inline Frame] geos_c.dll!GEOSIntersection_r::__l2::<lambda_3988e1633fcf92bee6886158a6950fe9>::operator()() Line 1322   C++
      geos_c.dll!execute<`anonymous namespace'::InterruptManager,<lambda_3988e1633fcf92bee6886158a6950fe9>,0>(GEOSContextHandle_HS * extHandle, GEOSIntersection_r::__l2::<lambda_3988e1633fcf92bee6886158a6950fe9> && f) Line 521  C++
      geos_c.dll!GEOSIntersection_r(GEOSContextHandle_HS * extHandle, const geos::geom::Geometry * g1, const geos::geom::Geometry * g2) Line 1326     C++
      gdal.dll!BuildGeometryFromTwoGeoms(const OGRGeometry * poSelf, const OGRGeometry * poOtherGeom, GEOSGeom_t *(*)(GEOSContextHandle_HS *, const GEOSGeom_t *, const GEOSGeom_t *) pfnGEOSFunction_r) Line 3814      C++
      gdal.dll!OGRMVTLayer::GetNextRawFeature() Line 1381   C++
      [Inline Frame] gdal.dll!OGRGetNextFeatureThroughRaw<OGRMVTLayerBase>::GetNextFeature() Line 513 C++
      gdal.dll!OGRMVTLayerBase::GetNextFeature() Line 144   C++
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20260608/76dd4b4f/attachment-0001.htm>


More information about the gdal-dev mailing list