tudelft3d / pprepair

Validation and Automatic Repair of Planar Partitions
GNU General Public License v3.0
57 stars 22 forks source link

Crash on first run #47

Open darkblue-b opened 7 years ago

darkblue-b commented 7 years ago

interested to use this tool, but it crashed badly on the very first test set. Environment is Ubuntu 14.04

pprepair$ valgrind build/pprepair -i /home/shared/test_pprepair/a2.shp -fix -o $WDIR/b2.shp
==6501== Memcheck, a memory error detector
==6501== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==6501== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==6501== Command: build/pprepair -i /home/shared/test_pprepair/a2.shp -fix -o /home/shared/test_pprepair/b2.shp
==6501== 
Adding a new set of polygons to the triangulation...
    Path: /home/shared/test_pprepair/a2.shp
    Type: ESRI Shapefile
    Layers: 1
    Reading layer #1 (18 polygons)...
>       int         gid
        string      statefp
        string      countyfp
        string      cousubfp
        string      cousubns
        string      geoid
        string      name
        string      namelsad
        string      lsad
        string      classfp
        string      mtfcc
        string      cnectafp
        string      nectafp
        string      nctadvfp
        string      funcstat
        double      aland
        double      awater
        string      intptlat
        string      intptlon
Polygons added (8 s). The triangulation has now:
    Vertices: 20547
    Edges: 61638
    Triangles: 41065
Tagging...
Tagging done (1 s).
Input triangulation:
    Holes:    0 triangles (0.000000 %)
    Ok:       41044 triangles (99.948862 %)
    Overlaps: 21 triangles (0.051138 %)
Repairing regions by longest boundary...
Repair successful (0 s). All polygons are now valid.
Triangulation already repaired!
Repaired triangulation:
    Holes:    0 triangles (0.000000 %)
    Ok:       41065 triangles (100.000000 %)
    Overlaps: 0 triangles (0.000000 %)
Reconstructing polygons (geometry)...
    Removed 11 constrained edges
Polygons reconstructed (1 s).
Exporting polygons...
ERROR 1: GeoJSON parsing error: unexpected end of data (at offset 31)
ERROR 4: Failed to read GeoJSON data
    Writing file... 
==6501== Conditional jump or move depends on uninitialised value(s)
==6501==    at 0x5ECE97C: OGRGeoJSONDataSource::ICreateLayer(char const*, OGRSpatialReference*, OGRwkbGeometryType, char**) (ogrgeojsondatasource.cpp:255)
==6501==    by 0x44B772: IOWorker::exportPolygons(std::vector<std::pair<PolygonHandle*, Polygon>, std::allocator<std::pair<PolygonHandle*, Polygon> > >&, char const*, bool) (in /home/shared/srcs/pprepair/build/pprepair)
==6501==    by 0x477A9A: PlanarPartition::exportPolygons(char const*, bool) (in /home/shared/srcs/pprepair/build/pprepair)
==6501==    by 0x43A6DB: main (in /home/shared/srcs/pprepair/build/pprepair)
==6501== 
==6501== Use of uninitialised value of size 8
==6501==    at 0x609ED38: OGRSpatialReference::GetAuthorityName(char const*) const (ogrspatialreference.cpp:5919)
==6501==    by 0x5ECE987: OGRGeoJSONDataSource::ICreateLayer(char const*, OGRSpatialReference*, OGRwkbGeometryType, char**) (ogrgeojsondatasource.cpp:257)
==6501==    by 0x44B772: IOWorker::exportPolygons(std::vector<std::pair<PolygonHandle*, Polygon>, std::allocator<std::pair<PolygonHandle*, Polygon> > >&, char const*, bool) (in /home/shared/srcs/pprepair/build/pprepair)
==6501==    by 0x477A9A: PlanarPartition::exportPolygons(char const*, bool) (in /home/shared/srcs/pprepair/build/pprepair)
==6501==    by 0x43A6DB: main (in /home/shared/srcs/pprepair/build/pprepair)
==6501== 
==6501== Invalid read of size 4
==6501==    at 0x60A7A1F: OGR_SRSNode::FindChild(char const*) const (ogr_srsnode.cpp:287)
==6501==    by 0x609ED01: OGRSpatialReference::GetAuthorityName(char const*) const (ogrspatialreference.cpp:5930)
==6501==    by 0x5ECE987: OGRGeoJSONDataSource::ICreateLayer(char const*, OGRSpatialReference*, OGRwkbGeometryType, char**) (ogrgeojsondatasource.cpp:257)
==6501==    by 0x44B772: IOWorker::exportPolygons(std::vector<std::pair<PolygonHandle*, Polygon>, std::allocator<std::pair<PolygonHandle*, Polygon> > >&, char const*, bool) (in /home/shared/srcs/pprepair/build/pprepair)
==6501==    by 0x477A9A: PlanarPartition::exportPolygons(char const*, bool) (in /home/shared/srcs/pprepair/build/pprepair)
==6501==    by 0x43A6DB: main (in /home/shared/srcs/pprepair/build/pprepair)
==6501==  Address 0x1c is not stack'd, malloc'd or (recently) free'd
==6501== 
==6501== 
==6501== Process terminating with default action of signal 11 (SIGSEGV)
==6501==  Access not within mapped region at address 0x1C
==6501==    at 0x60A7A1F: OGR_SRSNode::FindChild(char const*) const (ogr_srsnode.cpp:287)
==6501==    by 0x609ED01: OGRSpatialReference::GetAuthorityName(char const*) const (ogrspatialreference.cpp:5930)
==6501==    by 0x5ECE987: OGRGeoJSONDataSource::ICreateLayer(char const*, OGRSpatialReference*, OGRwkbGeometryType, char**) (ogrgeojsondatasource.cpp:257)
==6501==    by 0x44B772: IOWorker::exportPolygons(std::vector<std::pair<PolygonHandle*, Polygon>, std::allocator<std::pair<PolygonHandle*, Polygon> > >&, char const*, bool) (in /home/shared/srcs/pprepair/build/pprepair)
==6501==    by 0x477A9A: PlanarPartition::exportPolygons(char const*, bool) (in /home/shared/srcs/pprepair/build/pprepair)
==6501==    by 0x43A6DB: main (in /home/shared/srcs/pprepair/build/pprepair)
==6501==  If you believe this happened as a result of a stack
==6501==  overflow in your program's main thread (unlikely but
==6501==  possible), you can try to increase the size of the
==6501==  main thread stack using the --main-stacksize= flag.
==6501==  The main thread stack size used in this run was 8388608.
==6501== 
==6501== HEAP SUMMARY:
==6501==     in use at exit: 19,782,719 bytes in 295,681 blocks
==6501==   total heap usage: 581,439 allocs, 285,758 frees, 40,621,149 bytes allocated
==6501== 
==6501== LEAK SUMMARY:
==6501==    definitely lost: 704 bytes in 26 blocks
==6501==    indirectly lost: 1,120,904 bytes in 10,886 blocks
==6501==      possibly lost: 3,532,559 bytes in 63,269 blocks
==6501==    still reachable: 15,128,552 bytes in 221,500 blocks
==6501==         suppressed: 0 bytes in 0 blocks
==6501== Rerun with --leak-check=full to see details of leaked memory
==6501== 
==6501== For counts of detected and suppressed errors, rerun with: -v
==6501== Use --track-origins=yes to see where uninitialised values come from
==6501== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)
bmmeijers commented 7 years ago

Are you sure that you are not mixing data formats (both Shapefile/GeoJSON)?

Adding a new set of polygons to the triangulation... Path: /home/shared/test_pprepair/a2.shp Type: ESRI Shapefile

And then below:

Exporting polygons... ERROR 1: GeoJSON parsing error: unexpected end of data (at offset 31) ERROR 4: Failed to read GeoJSON data