[GRASS-dev] [GRASS GIS] #3165: v.out.ogr -c seg fault

#3165: v.out.ogr -c seg fault
---------------------+-------------------------
Reporter: ychemin | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone:
Component: Vector | Version: svn-trunk
Keywords: | CPU: x86-64
Platform: Linux |
---------------------+-------------------------
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.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3165&gt;
GRASS GIS <https://grass.osgeo.org>

#3165: v.out.ogr -c seg fault
----------------------+-------------------------
  Reporter: ychemin | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: Vector | Version: svn-trunk
Resolution: | Keywords: v.in.ogr
       CPU: x86-64 | Platform: Linux
----------------------+-------------------------
Changes (by martinl):

* keywords: => v.in.ogr
* milestone: => 7.0.5

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3165#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#3165: v.out.ogr -c seg fault
----------------------+-------------------------
  Reporter: ychemin | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: Vector | Version: svn-trunk
Resolution: | Keywords: v.in.ogr
       CPU: x86-64 | Platform: Linux
----------------------+-------------------------

Comment (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.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/3165#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#3165: v.out.ogr -c seg fault
----------------------+-------------------------
  Reporter: ychemin | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: Vector | Version: svn-trunk
Resolution: | Keywords: v.out.ogr
       CPU: x86-64 | Platform: Linux
----------------------+-------------------------
Changes (by mmetz):

* keywords: v.in.ogr => v.out.ogr

Comment:

Replying to [ticket:3165 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?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3165#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>

#3165: v.out.ogr -c seg fault
----------------------+-------------------------
  Reporter: ychemin | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: Vector | Version: svn-trunk
Resolution: | Keywords: v.out.ogr
       CPU: x86-64 | Platform: Linux
----------------------+-------------------------

Comment (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

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3165#comment:4&gt;
GRASS GIS <https://grass.osgeo.org>

#3165: v.out.ogr -c seg fault
----------------------+-------------------------
  Reporter: ychemin | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: Vector | Version: svn-trunk
Resolution: | Keywords: v.out.ogr
       CPU: x86-64 | Platform: Linux
----------------------+-------------------------

Comment (by mmetz):

Replying to [comment:4 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).

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3165#comment:5&gt;
GRASS GIS <https://grass.osgeo.org>

#3165: v.out.ogr -c seg fault
----------------------+-------------------------
  Reporter: ychemin | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.0.5
Component: Vector | Version: svn-trunk
Resolution: | Keywords: v.out.ogr
       CPU: x86-64 | Platform: Linux
----------------------+-------------------------

Comment (by ychemin):

Bug is indeed fixed, Thx MarkusM

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3165#comment:6&gt;
GRASS GIS <https://grass.osgeo.org>

#3165: v.out.ogr -c seg fault
----------------------+-------------------------
  Reporter: ychemin | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.5
Component: Vector | Version: svn-trunk
Resolution: fixed | Keywords: v.out.ogr
       CPU: x86-64 | Platform: Linux
----------------------+-------------------------
Changes (by ychemin):

* status: new => closed
* resolution: => fixed

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3165#comment:7&gt;
GRASS GIS <https://grass.osgeo.org>