Opened 14 years ago

Closed 14 years ago

#402 closed defect (worksforme) buffer overflow

Reported by: epatton Owned by: grass-dev@…
Priority: major Milestone: 6.4.0
Component: Vector Version: svn-develbranch6
Keywords: buffer overflow, vector, shapefile, import Cc:
CPU: x86-64 Platform: Linux


I'm trying to import a shapefile into Grass (one polygon). Here's the ogrinfo:

ogrinfo -al -so ntl_polygon_utm.shp
INFO: Open of `ntl_polygon_utm.shp'
      using driver `ESRI Shapefile' successful.

Layer name: ntl_polygon_utm
Geometry: Polygon
Feature Count: 1
Extent: (169847.156250, 4875588.500000) - (229881.546875, 4907886.500000)
Layer SRS WKT:
AREA: Real (13.11)
PERIMETER: Real (13.11)
NTL_: Integer (9.0)
NTL_ID: Integer (9.0)
NTL_SYM: Integer (4.0) chokes on it, however: dsn=. layer=ntl_polygon_utm output=A_Series_Mapsheet_1_Carto --o --v
Projection of input dataset and current location appear to match
Layer: ntl_polygon_utm
Importing map 1 features...
*** buffer overflow detected ***: terminated
======= Backtrace: =========
======= Memory map: ========
00400000-00409000 r-xp 00000000 08:03 981639                             /usr/local/grass-6.4.svn/bin/
00608000-00609000 r--p 00008000 08:03 981639                             /usr/local/grass-6.4.svn/bin/
00609000-0060a000 rw-p 00009000 08:03 981639                             /usr/local/grass-6.4.svn/bin/
01017000-01059000 rw-p 01017000 00:00 0                                  [heap]
7f1092b6f000-7f1092b7a000 r-xp 00000000 08:03 449765                     /lib/
7f1092b7a000-7f1092d79000 ---p 0000b000 08:03 449765                     /lib/
7f1092d79000-7f1092d7a000 r--p 0000a000 08:03 449765                     /lib/
7f1092d7a000-7f1092d7b000 rw-p 0000b000 08:03 449765                     /lib/
7f1092d7b000-7f1092d85000 r-xp 00000000 08:03 449775                     /lib/
7f1092d85000-7f1092f84000 ---p 0000a000 08:03 449775                     /lib/
7f1092f84000-7f1092f85000 r--p 00009000 08:03 449775                     /lib/
7f1092f85000-7f1092f86000 rw-p 0000a000 08:03 449775                     /lib/
7f1092f86000-7f1092f9c000 r-xp 00000000 08:03 449759                     /lib/
7f1092f9c000-7f109319b000 ---p 00016000 08:03 449759                     /lib/
7f109319b000-7f109319c000 r--p 00015000 08:03 449759                     /lib/
7f109319c000-7f109319d000 rw-p 00016000 08:03 449759                     /lib/
7f109319d000-7f109319f000 rw-p 7f109319d000 00:00 0 
7f109319f000-7f10931a7000 r-xp 00000000 08:03 449761                     /lib/
7f10931a7000-7f10933a6000 ---p 00008000 08:03 449761                     /lib/
7f10933a6000-7f10933a7000 r--p 00007000 08:03 449761                     /lib/
7f10933a7000-7f10933a8000 rw-p 00008000 08:03 449761                     /lib/
7f10933a8000-7f109345e000 r-xp 00000000 08:03 934123                     /usr/lib/
7f109345e000-7f109365d000 ---p 000b6000 08:03 934123                     /usr/lib/
7f109365d000-7f1093663000 r--p 000b5000 08:03 934123                     /usr/lib/
7f1093663000-7f1093664000 rw-p 000bb000 08:03 934123                     /usr/lib/
7f1093664000-7f109369b000 r-xp 00000000 08:03 449756                     /lib/
7f109369b000-7f109389a000 ---p 00037000 08:03 449756                     /lib/
7f109389a000-7f109389f000 rw-p 00036000 08:03 449756                     /lib/
7f109389f000-7f10938a5000 r-xp 00000000 08:03 426462                     /usr/local/grass-6.4.svn/lib/
7f10938a5000-7f1093aa4000 ---p 00006000 08:03 426462                     /usr/local/grass-6.4.svn/lib/
7f1093aa4000-7f1093aa5000 r--p 00005000 08:03 426462                     /usr/local/grass-6.4.svn/lib/
7f1093aa5000-7f1093aa6000 rw-p 00006000 08:03 426462                     /usr/local/grass-6.4.svn/lib/
7f1093aa6000-7f1093aaa000 r-xp 00000000 08:03 426504                     /usr/local/grass-6.4.svn/lib/
7f1093aaa000-7f1093ca9000 ---p 00004000 08:03 426504                     /usr/local/grass-6.4.svn/lib/
7f1093ca9000-7f1093caa000 r--p 00003000 08:03 426504                     /usr/local/grass-6.4.svn/lib/libgrass_vask.6.4.svn.soAborted

Running gdb explicity on this import produces the same backtrace info, with this extra bit at the very end:

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7f006cf91710 (LWP 13683)]
0x00007f006a68afd5 in raise () from /lib/

Any ideas?

~ E.

Attachments (1)

Test_polygon.tar.bz2 (7.6 KB ) - added by epatton 14 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 by martinl, 14 years ago

Can you send me sample data? Martin

by epatton, 14 years ago

Attachment: Test_polygon.tar.bz2 added

comment:2 by epatton, 14 years ago

Hi Martin, I've uploaded the polygon shapefile which is causing the errors.

~ Eric.

in reply to:  2 comment:3 by martinl, 14 years ago

Replying to epatton:

Hi Martin, I've uploaded the polygon shapefile which is causing the errors.

Hm, it seems to be platform-specific. I have imported the shapefile without problems (GNU/Linux, 32bit, gcc 4.1.3).


comment:4 by epatton, 14 years ago

It seems the problem is larger than just importing this shapefile. I tried exporting a different Grass vector from a different location to shapefile using v.out.ogr, then importing that shapefile back into its parent location. I get the same result, a buffer overflow.

Can anyone with a 64-bit system test importing shapefiles with

~ Eric.

in reply to:  4 comment:5 by mmetz, 14 years ago

Replying to epatton:

Can anyone with a 64-bit system test importing shapefiles with

No problems on GNU/Linux 64 bit, gcc 4.1.2, gdal 1.5.2, grass64 and grass70. Maybe this is specific to your particular platform? Compile and install gdal anew?

Markus M

comment:6 by martinl, 14 years ago

From grass-dev ML:

same problem here:

Ubuntu 8.10:

ii  gdal-bin                                  1.5.2-4.1~intrepid
ii  libgdal1-1.5.0                            1.5.2-4.1~intrepid
ii  libgdal1-1.5.0-grass                      1.5.2-1
ii  libgdal1-dev                              1.5.2-4.1~intrepid

applyes for GRASS 6.3 (les-ejk ubuntu package) and 6.4 (fresh source compilation)

the problem seems to be in ubuntu gdal package

$ ogrinfo /home/jachym/usr/src/thuban/thuban_trunk/Data/iceland/roads-line.shp
INFO: Open of `/home/jachym/usr/src/thuban/thuban_trunk/Data/iceland/roads-line.shp'
     using driver `ESRI Shapefile' successful.
1: roads-line (Line String)
$ ogrinfo /home/jachym/usr/src/thuban/thuban_trunk/Data/iceland/roads-line.shp

INFO: Open of `/home/jachym/usr/src/thuban/thuban_trunk/Data/iceland/roads-line.shp'
     using driver `ESRI Shapefile' successful.

Layer name: roads-line
Geometry: Line String
Feature Count: 839
Extent: (-24.450359, 63.426830) - (-13.556688, 66.520111)
Layer SRS WKT:
FNODE_: Real (11.0)
TNODE_: Real (11.0)
LPOLY_: Real (11.0)
RPOLY_: Real (11.0)
LENGTH: Real (12.3)
RDLINE_: Real (11.0)
RDLINE_ID: Real (11.0)
RDLNTYPE: Integer (2.0)
RDLNSTAT: Integer (2.0)
*** buffer overflow detected ***: ogrinfo terminated
======= Backtrace: =========
======= Memory map: ========
08048000-0804b000 r-xp 00000000 08:01 241275     /usr/bin/ogrinfo
0804b000-0804c000 r--p 00002000 08:01 241275     /usr/bin/ogrinfo
0804c000-0804d000 rw-p 00003000 08:01 241275     /usr/bin/ogrinfo
097df000-09800000 rw-p 097df000 00:00 0          [heap]

so, we have to dig in this direction


comment:7 by epatton, 14 years ago


I'm using gdal-1.5.3, compiled from source; so Ubuntu packages can't be the problem in my case. I'm recompiling Grass and gdal and will report the results soon.

~ Eric.

comment:8 by epatton, 14 years ago

I noticed the "OGRFeature16GetFieldAsString" error that we both had, and thought there might be a problem with the dbf file that was causing this error, so I tried opening it in Open Office, but that program chokes with an error "Unable to open file for reading". I then renamed the dbf to something else, and tried importing the shapefile via and it worked! I can view the vector fine; doesn't show anything out of the ordinary.

This is still disconcerting, as the attributes have not survived the import. It's not a big problem for the polygons I'm using in this case, as their only purpose is to be rasterized into masks later on, but still...and I can't understand why ooffice won't open the dbf; gnumeric doesn't have any problem opening it.

~ Eric.

comment:9 by epatton, 14 years ago

Resolution: worksforme
Status: newclosed

I've removed the gdal 1.5.2 version that shipped with Ubuntu 8.10 and compiled gdal 1.6.0 in its place. is working fine now, so I'm closing this bug.

~ Eric.

Note: See TracTickets for help on using tickets.