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

Segmentation fault in polygon.cpp #1071

Closed
gabe-sherman opened this issue Apr 19, 2024 · 0 comments · Fixed by #1076
Closed

Segmentation fault in polygon.cpp #1071

gabe-sherman opened this issue Apr 19, 2024 · 0 comments · Fixed by #1076

Comments

@gabe-sherman
Copy link

gabe-sherman commented Apr 19, 2024

A segmentation fault occurs in the below program. This behavior occurs at line 192 in polygon.cpp

#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include <geos_c.h>

static void handler(const char *fmt, ...){
    exit(0);
}

int main(int argc, char *argv[])
{
    initGEOS(handler, handler);
    GEOSGeometry *v0 = GEOSGeomFromWKT("POLYGON((0 0, 00 0,   0 0))");
    GEOSGeometry *v1 = GEOSConcaveHullOfPolygons(v0, 0.7, NULL, NULL);
    return 0;
}

Test Environment

Ubuntu 22.04, 64bit

How to trigger

./filename

Version

Latest: c8b889b

Address Sanitizer Output

/home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/src/triangulate/polygon/PolygonHoleJoiner.cpp:139:46: runtime error: member call on null pointer of type 'geos::geom::Polygon'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/src/triangulate/polygon/PolygonHoleJoiner.cpp:139:46 in 
AddressSanitizer:DEADLYSIGNAL
=================================================================
==308818==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x555555aa1ba4 bp 0x7fffffffcfe0 sp 0x7fffffffce30 T0)
==308818==The signal is caused by a READ memory access.
==308818==Hint: address points to the zero page.
    #0 0x555555aa1ba4 in geos::geom::Polygon::getExteriorRing() const /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/src/geom/Polygon.cpp:192:12
    #1 0x555555cbe649 in geos::triangulate::polygon::PolygonHoleJoiner::extractOrientedRings(geos::geom::Polygon const*) /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/src/triangulate/polygon/PolygonHoleJoiner.cpp:139:46
    #2 0x555555cbe46e in geos::triangulate::polygon::PolygonHoleJoiner::compute() /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/src/triangulate/polygon/PolygonHoleJoiner.cpp:123:5
    #3 0x555555cbe349 in geos::triangulate::polygon::PolygonHoleJoiner::join(geos::geom::Polygon const*) /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/src/triangulate/polygon/PolygonHoleJoiner.cpp:115:19
    #4 0x555555cb8aca in geos::triangulate::polygon::ConstrainedDelaunayTriangulator::triangulatePolygon(geos::geom::Polygon const*, geos::triangulate::tri::TriList<geos::triangulate::tri::Tri>&) /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/src/triangulate/polygon/ConstrainedDelaunayTriangulator.cpp:91:22
    #5 0x555555a0232d in geos::algorithm::hull::ConcaveHullOfPolygons::buildHullTris() /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/src/algorithm/hull/ConcaveHullOfPolygons.cpp:203:5
    #6 0x555555a00a40 in geos::algorithm::hull::ConcaveHullOfPolygons::getHull() /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/src/algorithm/hull/ConcaveHullOfPolygons.cpp:159:5
    #7 0x555555a00f1c in geos::algorithm::hull::ConcaveHullOfPolygons::concaveHullByLengthRatio(geos::geom::Geometry const*, double, bool, bool) /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/src/algorithm/hull/ConcaveHullOfPolygons.cpp:84:17
    #8 0x5555559560b6 in GEOSConcaveHullOfPolygons_r::$_54::operator()() const /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/capi/geos_ts_c.cpp:1322:17
    #9 0x5555559560b6 in _Z7executeIZ27GEOSConcaveHullOfPolygons_rE4$_54LDn0EEDTclfp0_EEP20GEOSContextHandle_HSOT_ /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/capi/geos_ts_c.cpp:430:16
    #10 0x555555955ddf in GEOSConcaveHullOfPolygons_r /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/capi/geos_ts_c.cpp:1320:16
    #11 0x555555935159 in main /home/gabesherman/harness_test/AutoHarn-Results/geos/autoharn-03/reproducer.c:15:24
    #12 0x7ffff7029d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #13 0x7ffff7029e3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #14 0x555555877574 in _start (/home/gabesherman/harness_test/AutoHarn-Results/geos/autoharn-03/reproducer+0x323574) (BuildId: 31c315615ecf9749b4dd0151fc920c5e257d4819)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/src/geom/Polygon.cpp:192:12 in geos::geom::Polygon::getExteriorRing() const
==308818==ABORTING
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant