Opened 3 years ago

Closed 3 years ago

#3165 closed defect (fixed)

v.out.ogr -c seg fault

Reported by: ychemin Owned by: grass-dev@…
Priority: normal Milestone: 7.0.5
Component: Vector Version: svn-trunk
Keywords: v.out.ogr Cc:
CPU: x86-64 Platform: Linux

Description

When using v.out.ogr on svn trunk with -c option, it seg faults.

v.out.ogr -e -c input=index type=area output=out.shp layer=1 format=ESRI_Shapefile

when removing the -c flag, the export runs peacefully.

Change History (7)

comment:1 Changed 3 years ago by martinl

Keywords: v.in.ogr added
Milestone: 7.0.5

comment:2 Changed 3 years ago by neteler

I tried with NC but no segfault occurs:

v.out.ogr -e -c input=zipcodes_wake type=area output=out.shp layer=1 format=ESRI_Shapefile
...
 100%
v.out.ogr complete. 48 features (Polygon type) written to <zipcodes_wake>
(ESRI_Shapefile format).

We need a reproducible example, ideally with the NC sample dataset.

comment:3 in reply to:  description Changed 3 years ago by mmetz

Keywords: v.out.ogr added; v.in.ogr removed

Replying to ychemin:

When using v.out.ogr on svn trunk with -c option, it seg faults.

v.out.ogr -e -c input=index type=area output=out.shp layer=1 format=ESRI_Shapefile

when removing the -c flag, the export runs peacefully.

Can you provide output of valgrind --tool=memcheck?

comment:4 Changed 3 years ago by ychemin

==9324== Memcheck, a memory error detector ==9324== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==9324== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright info ==9324== Command: v.out.ogr -e -c input=indices type=area output=home/yann/Desktop/watersheds/img1_4/out.shp layer=1 format=ESRI_Shapefile --overwrite ==9324== WARNING: The map contains islands. With the -c flag, islands will appear as

filled areas, not holes in the output map.

==9324== Use of uninitialised value of size 8 ==9324== at 0x507515D: Vect_get_centroid_area (level_two.c:440) ==9324== by 0x10DFBF: export_areas_single (export_areas.c:81) ==9324== by 0x10DFBF: export_areas (export_areas.c:33) ==9324== by 0x10CCC1: main (main.c:737) ==9324== ==9324== Invalid read of size 1 ==9324== at 0x507515D: Vect_get_centroid_area (level_two.c:440) ==9324== by 0x10DFBF: export_areas_single (export_areas.c:81) ==9324== by 0x10DFBF: export_areas (export_areas.c:33) ==9324== by 0x10CCC1: main (main.c:737) ==9324== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==9324== ==9324== ==9324== Process terminating with default action of signal 11 (SIGSEGV) ==9324== Access not within mapped region at address 0x0 ==9324== at 0x507515D: Vect_get_centroid_area (level_two.c:440) ==9324== by 0x10DFBF: export_areas_single (export_areas.c:81) ==9324== by 0x10DFBF: export_areas (export_areas.c:33) ==9324== by 0x10CCC1: main (main.c:737) ==9324== If you believe this happened as a result of a stack ==9324== overflow in your program's main thread (unlikely but ==9324== possible), you can try to increase the size of the ==9324== main thread stack using the --main-stacksize= flag. ==9324== The main thread stack size used in this run was 8388608. ==9324== ==9324== HEAP SUMMARY: ==9324== in use at exit: 24,336,088 bytes in 932,399 blocks ==9324== total heap usage: 978,460 allocs, 46,061 frees, 29,688,816 bytes allocated ==9324== ==9324== LEAK SUMMARY: ==9324== definitely lost: 602 bytes in 30 blocks ==9324== indirectly lost: 2,261 bytes in 114 blocks ==9324== possibly lost: 0 bytes in 0 blocks ==9324== still reachable: 24,333,225 bytes in 932,255 blocks ==9324== suppressed: 0 bytes in 0 blocks ==9324== Rerun with --leak-check=full to see details of leaked memory ==9324== ==9324== For counts of detected and suppressed errors, rerun with: -v ==9324== Use --track-origins=yes to see where uninitialised values come from ==9324== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0) /home/yann/Desktop/watersheds/script.sh: line 383: 9324 Segmentation fault (core dumped) valgrind --tool=memcheck v.out.ogr -e -c input=indices type=area output=$GIS_OPT_SHNAME layer=1 format=ESRI_Shapefile --overwrite

comment:5 in reply to:  4 Changed 3 years ago by mmetz

Replying to ychemin:

==9324== Memcheck, a memory error detector
==9324== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==9324== Using Valgrind-3.12.0.SVN and LibVEX; rerun with -h for copyright info
==9324== Command: v.out.ogr -e -c input=indices type=area output=//home/yann/Desktop/watersheds/img1_4/out.shp layer=1 format=ESRI_Shapefile --overwrite
==9324== 
WARNING: The map contains islands. With the -c flag, islands will appear as
         filled areas, not holes in the output map.
==9324== Use of uninitialised value of size 8
==9324==    at 0x507515D: Vect_get_centroid_area (level_two.c:440)
==9324==    by 0x10DFBF: export_areas_single (export_areas.c:81)
==9324==    by 0x10DFBF: export_areas (export_areas.c:33)
==9324==    by 0x10CCC1: main (main.c:737)

Thanks, fixed in r69546-8 (trunk, relbr72, relbr70).

comment:6 Changed 3 years ago by ychemin

Bug is indeed fixed, Thx MarkusM

comment:7 Changed 3 years ago by ychemin

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.