[GRASS-dev] [GRASS GIS] #3814: v.buffer: sefault in LL

#3814: v.buffer: sefault in LL
-------------------------+-------------------------
Reporter: neteler | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.8.0
Component: LibVector | Version: svn-trunk
Keywords: v.buffer | CPU: Unspecified
Platform: Unspecified |
-------------------------+-------------------------
Inspired by an article [1] I tried v.buffer in a EPSG 4326 location:

{{{
GRASS 7.7.svn (latlong_wgs84):~ >
g.region n=90 s=-90 w=-180 e=180 res=1

v.random output=random100 n=100

v.buffer input=random100 output=random100_buff distance=0:00:01
Note: In latitude-longitude coordinate system specify distances in degree
unit
Buffering features...
Segmentation fault (core dumped)
}}}

Minimal debugging:
{{{
gdb v.buffer
GNU gdb (GDB) Fedora 8.2-6.fc29
(gdb) r input=random100 output=random100_buff distance=0:00:01 --o
...
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f71bc4 in Vect_point_buffer2 () from
/home/mneteler/software/grass77/dist.x86_64-pc-linux-
gnu/lib/libgrass_vector.7.7.so
}}}

Version:
{{{
g.version -g
version=7.7.svn
date=2019
revision=r74334M
build_date=2019-04-02
build_platform=x86_64-pc-linux-gnu
build_off_t_size=8
}}}

In G76 it also crashes.

[1] https://spatialthoughts.com/2019/04/05/geodesic-buffers-in-qgis/

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

#3814: v.buffer: segfault in LL
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.0
Component: LibVector | Version: svn-trunk
Resolution: | Keywords: v.buffer
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

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

#3814: v.buffer: segfault in LL
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.0
Component: LibVector | Version: svn-trunk
Resolution: | Keywords: v.buffer
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by mmetz):

Replying to [ticket:3814 neteler]:
> Inspired by an article [1] I tried v.buffer in a EPSG 4326 location:
>
>
> {{{
> GRASS 7.7.svn (latlong_wgs84):~ >
> g.region n=90 s=-90 w=-180 e=180 res=1
>
> v.random output=random100 n=100
>
> v.buffer input=random100 output=random100_buff distance=0:00:01
> Note: In latitude-longitude coordinate system specify distances in
degree
> unit
> Buffering features...
> Segmentation fault (core dumped)
> }}}

`distance=0:00:01` becomes `distance=0` because distance must be of type
double, in this case 1/3600 = 0.0002777778

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

#3814: v.buffer: segfault in LL
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.0
Component: LibVector | Version: svn-trunk
Resolution: | Keywords: v.buffer
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by mmetz):

In [changeset:"74387" 74387]:
{{{
#!CommitTicketReference repository="" revision="74387"
v.buffer: +test for zero distance, see #3814
}}}

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

#3814: v.buffer: segfault in LL
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.8.0
Component: LibVector | Version: svn-trunk
Resolution: | Keywords: v.buffer
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by mmetz):

In [changeset:"74388" 74388]:
{{{
#!CommitTicketReference repository="" revision="74388"
v.buffer: +test for zero distance, see #3814 (backport trunk r74387)
}}}

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

#3814: v.buffer: segfault in LL
--------------------------+-------------------------
  Reporter: neteler | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.8.0
Component: LibVector | Version: svn-trunk
Resolution: fixed | Keywords: v.buffer
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------
Changes (by neteler):

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

Comment:

Thanks, fixed!

Yes, the zero distance results from me having specified the distance in
sexagesimal notation.
g.region uses G_scan_northing() etc for that. But that's probably for a
separate enhancement ticket.

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