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 FacetSequence.cpp #1079

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

Segmentation Fault in FacetSequence.cpp #1079

gabe-sherman opened this issue Apr 20, 2024 · 0 comments · Fixed by #1082

Comments

@gabe-sherman
Copy link

A segmentation fault occurs in the below program. This behavior occurs at line 49 in FacetSequence.cpp

#include "geos_c.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
typedef uint8_t   u8;   
typedef uint16_t  u16;  
typedef uint32_t  u32;  
typedef uint64_t  u64;
typedef unsigned int usize;
typedef int8_t  i8;
typedef int16_t i16;
typedef int32_t i32;
typedef int64_t i64;
typedef int isize;
typedef float f32;
typedef double f64;
int main() {
    struct GEOSContextHandle_HS *v0 = GEOS_init_r(); // handle
    if (v0 == NULL) return 0;
    struct GEOSContextHandle_HS *v2 = v0; // handle
    f64 v3 = NAN; // x
    f64 v4 = 44.347106881966184; // y
    struct GEOSGeom_t *v5 = GEOSGeom_createPointFromXY_r(v2, v3, v4); // g
    if (v5 == NULL) return 0;
    struct GEOSGeom_t *v7 = v5; // g
    f64 v8_tmp[] = {52.4390827558148, 0.0, }; // distance
    f64 *v8 = malloc(sizeof v8_tmp);
    memcpy(v8, v8_tmp, sizeof v8_tmp);
    f64 *v9 = v8; // distance
    i32 v10 = GEOSMinimumClearance_r(v2, v7, v9); // $target
}

Test Environment

Ubuntu 22.04, 64bit

How to trigger

./filename

Version

Latest: c8b889b

Address Sanitizer Output

=================================================================
==2430376==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x555555de6ce9 bp 0x7fffffffd540 sp 0x7fffffffd0f0 T0)
==2430376==The signal is caused by a READ memory access.
==2430376==Hint: address points to the zero page.
    #0 0x555555de6ce9 in geos::operation::distance::FacetSequence::size() const /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/src/operation/distance/FacetSequence.cpp
    #1 0x555555c81971 in geos::precision::MinimumClearance::compute()::MinClearanceDistance::vertexDistance(geos::operation::distance::FacetSequence const*, geos::operation::distance::FacetSequence const*) /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/src/precision/MinimumClearance.cpp:115:47
    #2 0x555555c81971 in geos::precision::MinimumClearance::compute()::MinClearanceDistance::distance(geos::operation::distance::FacetSequence const*, geos::operation::distance::FacetSequence const*) /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/src/precision/MinimumClearance.cpp:95:13
    #3 0x555555c80911 in geos::precision::MinimumClearance::compute() /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/src/precision/MinimumClearance.cpp:179:24
    #4 0x555555c7fcb8 in geos::precision::MinimumClearance::getDistance() /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/src/precision/MinimumClearance.cpp:38:5
    #5 0x55555594fc1e in GEOSMinimumClearance_r::$_60::operator()() const /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/capi/geos_ts_c.cpp:1392:29
    #6 0x55555594fc1e in decltype(fp0) execute<GEOSMinimumClearance_r::$_60>(GEOSContextHandle_HS*, std::conditional<std::is_same<decltype(std::declval<GEOSMinimumClearance_r::$_60>()()), bool>::value, char, decltype(std::declval<GEOSMinimumClearance_r::$_60>()())>::type, GEOSMinimumClearance_r::$_60&&) /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/capi/geos_ts_c.cpp:406:16
    #7 0x55555594fa31 in GEOSMinimumClearance_r /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/capi/geos_ts_c.cpp:1390:16
    #8 0x55555592d2df in main /home/gabesherman/harness_test/AutoHarn-Results/geos/hopper-08/reproducer.c:33:15
    #9 0x7ffff7029d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #10 0x7ffff7029e3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #11 0x55555586f524 in _start (/home/gabesherman/harness_test/AutoHarn-Results/geos/hopper-08/reproducer+0x31b524) (BuildId: 5a3857849b2105b33258d90f38a486e5a19d8e99)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/gabesherman/harness_test/AutoHarn-Evaluation/geos/lib_asan/src/operation/distance/FacetSequence.cpp in geos::operation::distance::FacetSequence::size() const
==2430376==ABORTING

dbaston added a commit to dbaston/libgeos that referenced this issue Apr 20, 2024
dbaston added a commit to dbaston/libgeos that referenced this issue Apr 20, 2024
dbaston added a commit that referenced this issue Apr 25, 2024
dbaston added a commit that referenced this issue Jun 17, 2024
dbaston added a commit that referenced this issue Jun 17, 2024
dbaston added a commit that referenced this issue Jun 17, 2024
pramsey added a commit that referenced this issue Oct 24, 2024
pramsey pushed a commit that referenced this issue Oct 24, 2024
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