Opened 12 years ago

Last modified 6 years ago

#1906 new enhancement

Raster "title" longer than 100 characters segfaults ps.map -- Request to extend the field's capacity.

Reported by: Nikos Alexandris Owned by: grass-dev@…
Priority: minor Milestone: 7.6.2
Component: Ps.map Version: svn-trunk
Keywords: ps.map, header, r.support, title Cc:
CPU: x86-64 Platform: Unspecified

Description (last modified by martinl)

The "title" of a raster map is part of ps.map's "header" instruction. Defining a title to a raster map (r.support) with more than 100 characters, causes a segfault when trying to draw this map with ps.map.

Tested using data from the "spearfish60" Location in both G6 and G7, e.g.:

# under G7 -- set a low resolution for a quick test!
g.region res=1000 -pa

# define raster "title"
r.support landcover.30m title="123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789"

# ps.map-it
ps.map --v in=spearfish_landcover_30m.psmap out=spearfish_landcover_30m.ps

Scale set to 1 : 21668
Reading raster map <landcover.30m@user1>...
Reading text file ...
ps.map complete. PostScript file
'/geo/projects/ArcFUEL/psmap_scripts/spearfish_landcover_30m.ps'
successfully written.

# add another character to the title...
r.support landcover.30m title="123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789A"

# ps.map-it...
ps.map --v --o in=spearfish_landcover_30m.psmap out=spearfish_landcover_30m.ps
*** buffer overflow detected ***: ps.map terminated
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x5c)[0x7f41fc0fb82c]
/lib/x86_64-linux-gnu/libc.so.6(+0x109700)[0x7f41fc0fa700]
ps.map(read_cell+0xd5)[0x416445]
ps.map(read_instructions+0x87d)[0x41819d]
ps.map(main+0x582)[0x405f72]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7f41fc01276d]
ps.map[0x406155]
======= Memory map: ========
00400000-00425000 r-xp 00000000 08:06 602561255                          /geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-gnu/bin/ps.map
00624000-00625000 r--p 00024000 08:06 602561255                          /geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-gnu/bin/ps.map
00625000-00626000 rw-p 00025000 08:06 602561255                          /geo/osgeo/src/grass_trunk/dist.x86_64-unknown-linux-gnu/bin/ps.map
00626000-00628000 rw-p 00000000 00:00 0 
0112b000-0114c000 rw-p 00000000 00:00 0                                  [heap]
7f41f0c2c000-7f41f106f000 r--p 00000000 08:04 2235368                    /usr/lib/locale/locale-archive
7f41f106f000-7f41f1078000 r-xp 00000000 08:04 131343                     /lib/x86_64-linux-gnu/libcrypt-2.15.so
7f41f1078000-7f41f1278000 ---p 00009000 08:04 131343                     /lib/x86_64-linux-gnu/libcrypt-2.15.so
7f41f1278000-7f41f1279000 r--p 00009000 08:04 131343                     /lib/x86_64-linux-gnu/libcrypt-2.15.so
7f41f1279000-7f41f127a000 rw-p 0000a000 08:04 131343                     /lib/x86_64-linux-gnu/libcrypt-2.15.so
7f41f127a000-7f41f12a8000 rw-p 00000000 00:00 0 
7f41f12a8000-7f41f12ec000 r-xp 00000000 08:04 2229277                    /usr/lib/x86_64-linux-gnu/libhx509.so.5.0.0
7f41f12ec000-7f41f14ec000 ---p 00044000 08:04 2229277                    /usr/lib/x86_64-linux-gnu/libhx509.so.5.0.0
7f41f14ec000-7f41f14ee000 r--p 00044000 08:04 2229277                    /usr/lib/x86_64-linux-gnu/libhx509.so.5.0.0
7f41f14ee000-7f41f14f0000 rw-p 00046000 08:04 2229277                    /usr/lib/x86_64-linux-gnu/libhx509.so.5.0.0
7f41f14f0000-7f41f14fd000 r-xp 00000000 08:04 2229255                    /usr/lib/x86_64-linux-gnu/libheimbase.so.1.0.0
7f41f14fd000-7f41f16fc000 ---p 0000d000 08:04 2229255                    /usr/lib/x86_64-linux-gnu/libheimbase.so.1.0.0
7f41f16fc000-7f41f16fd000 r--p 0000c000 08:04 2229255                    /usr/lib/x86_64-linux-gnu/libheimbase.so.1.0.0
7f41f16fd000-7f41f16fe000 rw-p 0000d000 08:04 2229255                    /usr/lib/x86_64-linux-gnu/libheimbase.so.1.0.0
7f41f16fe000-7f41f1726000 r-xp 00000000 08:04 2229275                    /usr/lib/x86_64-linux-gnu/libwind.so.0.0.0
7f41f1726000-7f41f1925000 ---p 00028000 08:04 2229275                    /usr/lib/x86_64-linux-gnu/libwind.so.0.0.0
7f41f1925000-7f41f1926000 r--p 00027000 08:04 2229275                    /usr/lib/x86_64-linux-gnu/libwind.so.0.0.0
7f41f1926000-7f41f1927000 rw-p 00028000 08:04 2229275                    /usr/lib/x86_64-linux-gnu/libwind.so.0.0.0
7f41f1927000-7f41f1928000 rw-p 00000000 00:00 0 
7f41f1928000-7f41f193b000 r-xp 00000000 08:04 2230343                    /usr/lib/x86_64-linux-gnu/libroken.so.18.1.0
7f41f193b000-7f41f1b3b000 ---p 00013000 08:04 2230343                    /usr/lib/x86_64-linux-gnu/libroken.so.18.1.0
7f41f1b3b000-7f41f1b3c000 r--p 00013000 08:04 2230343                    /usr/lib/x86_64-linux-gnu/libroken.so.18.1.0
7f41f1b3c000-7f41f1b3d000 rw-p 00014000 08:04 2230343                    /usr/lib/x86_64-linux-gnu/libroken.so.18.1.0
7f41f1b3d000-7f41f1b6d000 r-xp 00000000 08:04 2229184                    /usr/lib/x86_64-linux-gnu/libhcrypto.so.4.1.0
7f41f1b6d000-7f41f1d6c000 ---p 00030000 08:04 2229184                    /usr/lib/x86_64-linux-gnu/libhcrypto.so.4.1.0
7f41f1d6c000-7f41f1d6e000 r--p 0002f000 08:04 2229184                    /usr/lib/x86_64-linux-gnu/libhcrypto.so.4.1.0
7f41f1d6e000-7f41f1d6f000 rw-p 00031000 08:04 2229184                    /usr/lib/x86_64-linux-gnu/libhcrypto.so.4.1.0
7f41f1d6f000-7f41f1d70000 rw-p 00000000 00:00 0 
7f41f1d70000-7f41f1e03000 r-xp 00000000 08:04 2229157                    /usr/lib/x86_64-linux-gnu/libasn1.so.8.0.0
7f41f1e03000-7f41f2002000 ---p 00093000 08:04 2229157                    /usr/lib/x86_64-linux-gnu/libasn1.so.8.0.0
7f41f2002000-7f41f2004000 r--p 00092000 08:04 2229157                    /usr/lib/x86_64-linux-gnu/libasn1.so.8.0.0
7f41f2004000-7f41f2006000 rw-p 00094000 08:04 2229157                    /usr/lib/x86_64-linux-gnu/libasn1.so.8.0.0
7f41f2006000-7f41f2082000 r-xp 00000000 08:04 2229284                    /usr/lib/x86_64-linux-gnu/libkrb5.so.26.0.0
7f41f2082000-7f41f2282000 ---p 0007c000 08:04 2229284                    /usr/lib/x86_64-linux-gnu/libkrb5.so.26.0.0
7f41f2282000-7f41f2284000 r--p 0007c000 08:04 2229284                    /usr/lib/x86_64-linux-gnu/libkrb5.so.26.0.0
7f41f2284000-7f41f2287000 rw-p 0007e000 08:04 2229284                    /usr/lib/x86_64-linux-gnu/libkrb5.so.26.0.0
7f41f2287000-7f41f2288000 rw-p 00000000 00:00 0 
7f41f2288000-7f41f228e000 r-xp 00000000 08:04 2229326                    /usr/lib/x86_64-linux-gnu/libheimntlm.so.0.1.0
7f41f228e000-7f41f248d000 ---p 00006000 08:04 2229326                    /usr/lib/x86_64-linux-gnu/libheimntlm.so.0.1.0
7f41f248d000-7f41f248e000 r--p 00005000 08:04 2229326                    /usr/lib/x86_64-linux-gnu/libheimntlm.so.0.1.0
7f41f248e000-7f41f248f000 rw-p 00006000 08:04 2229326                    /usr/lib/x86_64-linux-gnu/libheimntlm.so.0.1.0
7f41f248f000-7f41f2490000 rw-p 00000000 00:00 0 
7f41f2490000-7f41f2493000 r-xp 00000000 08:04 131436                     /lib/x86_64-linux-gnu/libgpg-error.so.0.8.0
7f41f2493000-7f41f2692000 ---p 00003000 08:04 131436                     /lib/x86_64-linux-gnu/libgpg-error.so.0.8.0
7f41f2692000-7f41f2693000 r--p 00002000 08:04 131436                     /lib/x86_64-linux-gnu/libgpg-error.so.0.8.0
7f41f2693000-7f41f2694000 rw-p 00003000 08:04 131436                     /lib/x86_64-linux-gnu/libgpg-error.so.0.8.0
7f41f2694000-7f41f26a6000 r-xp 00000000 08:04 2229946                    /usr/lib/x86_64-linux-gnu/libp11-kit.so.0.0.0
7f41f26a6000-7f41f28a6000 ---p 00012000 08:04 2229946                    /usr/lib/x86_64-linux-gnu/libp11-kit.so.0.0.0
7f41f28a6000-7f41f28a7000 r--p 00012000 08:04 2229946                    /usr/lib/x86_64-linux-gnu/libp11-kit.so.0.0.0
7f41f28a7000-7f41f28a8000 rw-p 00013000 08:04 2229946                    /usr/lib/x86_64-linux-gnu/libp11-kit.so.0.0.0
7f41f28a8000-7f41f28a9000 rw-p 00000000 00:00 0 
7f41f28a9000-7f41f28b8000 r-xp 00000000 08:04 2228406                    /usr/lib/x86_64-linux-gnu/libtasn1.so.3.1.16
7f41f28b8000-7f41f2ab8000 ---p 0000f000 08:04 2228406                    /usr/lib/x86_64-linux-gnu/libtasn1.so.3.1.16
7f41f2ab8000-7f41f2ab9000 r--p 0000f000 08:04 2228406                    /usr/lib/x86_64-linux-gnu/libtasn1.so.3.1.16
7f41f2ab9000-7f41f2aba000 rw-p 00010000 08:04 2228406                    /usr/lib/x86_64-linux-gnu/libtasn1.so.3.1.16
7f41f2aba000-7f41f3c29000 r-xp 00000000 08:04 2229175                    /usr/lib/x86_64-linux-gnu/libicudata.so.48.1.1
7f41f3c29000-7f41f3e28000 ---p 0116f000 08:04 2229175                    /usr/lib/x86_64-linux-gnu/libicudata.so.48.1.1
7f41f3e28000-7f41f3e29000 r--p 0116e000 08:04 2229175                    /usr/lib/x86_64-linux-gnu/libicudata.so.48.1.1
7f41f3e29000-7f41f3e2a000 rw-p 0116f000 08:04 2229175                    /usr/lib/x86_64-linux-gnu/libicudata.so.48.1.1
7f41f3e2a000-7f41f3e63000 r-xp 00000000 08:04 2229334                    /usr/lib/x86_64-linux-gnu/libgssapi.so.3.0.0
7f41f3e63000-7f41f4063000 ---p 00039000 08:04 2229334                    /usr/lib/x86_64-linux-gnu/libgssapi.so.3.0.0
7f41f4063000-7f41f4064000 r--p 00039000 08:04 2229334                    /usr/lib/x86_64-linux-gnu/libgssapi.so.3.0.0
7f41f4064000-7f41f4066000 rw-p 0003a000 08:04 2229334                    /usr/lib/x86_64-linux-gnu/libgssapi.so.3.0.0
7f41f4066000-7f41f4067000 rw-p 00000000 00:00 0 
7f41f4067000-7f41f4080000 r-xp 00000000 08:04 2235675                    /usr/lib/x86_64-linux-gnu/libsasl2.so.2.0.25
7f41f4080000-7f41f4280000 ---p 00019000 08:04 2235675                    /usr/lib/x86_64-linux-gnu/libsasl2.so.2.0.25
7f41f4280000-7f41f4281000 r--p 00019000 08:04 2235675                    /usr/lib/x86_64-linux-gnu/libsasl2.so.2.0.25
7f41f4281000-7f41f4282000 rw-p 0001a000 08:04 2235675                    /usr/lib/x86_64-linux-gnu/libsasl2.so.2.0.25
7f41f4282000-7f41f429a000 r-xp 00000000 08:04 131294                     /lib/x86_64-linux-gnu/libresolv-2.15.so
7f41f429a000-7f41f449a000 ---p 00018000 08:04 131294                     /lib/x86_64-linux-gnu/libresolv-2.15.so
7f41f449a000-7f41f449b000 r--p 00018000 08:04 131294                     /lib/x86_64-linux-gnu/libresolv-2.15.so
7f41f449b000-7f41f449c000 rw-p 00019000 08:04 131294                     /lib/x86_64-linux-gnu/libresolv-2.15.so
7f41f449c000-7f41f449f000 rw-p 00000000 00:00 0 
7f41f449f000-7f41f44a1000 r-xp 00000000 08:04 131646                     /lib/x86_64-linux-gnu/libkeyutils.so.1.4
7f41f44a1000-7f41f46a1000 ---p 00002000 08:04 131646                     /lib/x86_64-linux-gnu/libkeyutils.so.1.4
7f41f46a1000-7f41f46a2000 r--p 00002000 08:04 131646                     /lib/x86_64-linux-gnu/libkeyutils.so.1.4
7f41f46a2000-7f41f46a3000 rw-p 00003000 08:04 131646                     /lib/x86_64-linux-gnu/libkeyutils.so.1.4
7f41f46a3000-7f41f46aa000 r-xp 00000000 08:04 2229072                    /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
7f41f46aa000-7f41f48a9000 ---p 00007000 08:04 2229072                    /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
7f41f48a9000-7f41f48aa000 r--p 00006000 08:04 2229072                    /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
7f41f48aa000-7f41f48ab000 rw-p 00007000 08:04 2229072                    /usr/lib/x86_64-linux-gnu/libkrb5support.so.0.1
7f41f48ab000-7f41f48d1000 r-xp 00000000 08:04 2230359                    /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1
7f41f48d1000-7f41f4ad1000 ---p 00026000 08:04 2230359                    /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1
7f41f4ad1000-7f41f4ad2000 r--p 00026000 08:04 2230359                    /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1
7f41f4ad2000-7f41f4ad3000 rw-p 00027000 08:04 2230359                    /usr/lib/x86_64-linux-gnu/libk5crypto.so.3.1
7f41f4ad3000-7f41f4ad5000 rw-p 00000000 00:00 0 
7f41f4ad5000-7f41f4aee000 r-xp 00000000 08:04 2229314                    /usr/lib/x86_64-linux-gnu/librtmp.so.0
7f41f4aee000-7f41f4ced000 ---p 00019000 08:04 2229314                    /usr/lib/x86_64-linux-gnu/librtmp.so.0
7f41f4ced000-7f41f4cee000 r--p 00018000 08:04 2229314                    /usr/lib/x86_64-linux-gnu/librtmp.so.0
7f41f4cee000-7f41f4cef000 rw-p 00019000 08:04 2229314                    /usr/lib/x86_64-linux-gnu/librtmp.so.0
7f41f4cef000-7f41f4d69000 r-xp 00000000 08:04 131438                     /lib/x86_64-linux-gnu/libgcrypt.so.11.7.0
7f41f4d69000-7f41f4f69000 ---p 0007a000 08:04 131438                     /lib/x86_64-linux-gnu/libgcrypt.so.11.7.0
7f41f4f69000-7f41f4f6a000 r--p 0007a000 08:04 131438                     /lib/x86_64-linux-gnu/libgcrypt.so.11.7.0
7f41f4f6a000-7f41f4f6d000 rw-p 0007b000 08:04 131438                     /lib/x86_64-linux-gnu/libgcrypt.so.11.7.0
7f41f4f6d000-7f41f5021000 r-xp 00000000 08:04 2246235                    /usr/lib/x86_64-linux-gnu/libgnutls.so.26.21.8
7f41f5021000-7f41f5221000 ---p 000b4000 08:04 2246235                    /usr/lib/x86_64-linux-gnu/libgnutls.so.26.21.8
7f41f5221000-7f41f5227000 r--p 000b4000 08:04 2246235                    /usr/lib/x86_64-linux-gnu/libgnutls.so.26.21.8
7f41f5227000-7f41f5228000 rw-p 000ba000 08:04 2246235                    /usr/lib/x86_64-linux-gnu/libgnutls.so.26.21.8
7f41f5228000-7f41f522a000 rw-p 00000000 00:00 0 
7f41f522a000-7f41f5231000 r-xp 00000000 08:04 131293                     /lib/x86_64-linux-gnu/librt-2.15.so
7f41f5231000-7f41f5430000 ---p 00007000 08:04 131293                     /lib/x86_64-linux-gnu/librt-2.15.so
7f41f5430000-7f41f5431000 r--p 00006000 08:04 131293                     /lib/x86_64-linux-gnu/librt-2.15.so
7f41f5431000-7f41f5432000 rw-p 00007000 08:04 131293                     /lib/x86_64-linux-gnu/librt-2.15.so
7f41f5432000-7f41f543f000 r-xp 00000000 08:04 2229242                    /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2.8.3
7f41f543f000-7f41f563e000 ---p 0000d000 08:04 2229242                    /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2.8.3
7f41f563e000-7f41f563f000 r--p 0000c000 08:04 2229242                    /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2.8.3
7f41f563f000-7f41f5640000 rw-p 0000d000 08:04 2229242                    /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2.8.3
7f41f5640000-7f41f5671000 r-xp 00000000 08:04 2228377                    /usr/lib/x86_64-linux-gnu/libidn.so.11.6.8
7f41f5671000-7f41f5871000 ---p 00031000 08:04 2228377                    /usr/lib/x86_64-linux-gnu/libidn.so.11.6.8
7f41f5871000-7f41f5872000 r--p 00031000 08:04 2228377                    /usr/lib/x86_64-linux-gnu/libidn.so.11.6.8
7f41f5872000-7f41f5873000 rw-p 00032000 08:04 2228377                    /usr/lib/x86_64-linux-gnu/libidn.so.11.6.8
7f41f5873000-7f41f5874000 rw-p 00000000 00:00 0 
7f41f5874000-7f41f5890000 r-xp 00000000 08:04 2253286                    /usr/lib/libhdf5_hl.so.7.0.2
7f41f5890000-7f41f5a8f000 ---p 0001c000 08:04 2253286                    /usr/lib/libhdf5_hl.so.7.0.2
7f41f5a8f000-7f41f5a90000 r--p 0001b000 08:04 2253286                    /usr/lib/libhdf5_hl.so.7.0.2
7f41f5a90000-7f41f5a91000 rw-p 0001c000 08:04 2253286                    /usr/lib/libhdf5_hl.so.7.0.2
7f41f5a91000-7f41f5aa2000 rw-p 00000000 00:00 0 
7f41f5aa2000-7f41f5ae1000 r-xp 00000000 08:04 2245096                    /usr/lib/x86_64-linux-gnu/libjpeg.so.8.0.2
7f41f5ae1000-7f41f5ce1000 ---p 0003f000 08:04 2245096                    /usr/lib/x86_64-linux-gnu/libjpeg.so.8.0.2
7f41f5ce1000-7f41f5ce2000 r--p 0003f000 08:04 2245096                    /usr/lib/x86_64-linux-gnu/libjpeg.so.8.0.2
7f41f5ce2000-7f41f5ce3000 rw-p 00040000 08:04 2245096                    /usr/lib/x86_64-linux-gnu/libjpeg.so.8.0.2
7f41f5ce3000-7f41f5cf3000 rw-p 00000000 00:00 0 
7f41f5cf3000-7f41f5e49000 r-xp 00000000 08:04 2228488                    /usr/lib/x86_64-linux-gnu/libicuuc.so.48.1.1
7f41f5e49000-7f41f6048000 ---p 00156000 08:04 2228488                    /usr/lib/x86_64-linux-gnu/libicuuc.so.48.1.1
7f41f6048000-7f41f6059000 r--p 00155000 08:04 2228488                    /usr/lib/x86_64-linux-gnu/libicuuc.so.48.1.1
7f41f6059000-7f41f605a000 rw-p 00166000 08:04 2228488                    /usr/lib/x86_64-linux-gnu/libicuuc.so.48.1.1
7f41f605a000-7f41f605f000 rw-p 00000000 00:00 0 
7f41f605f000-7f41f6068000 r-xp 00000000 08:04 2229711                    /usr/lib/x86_64-linux-gnu/libltdl.so.7.3.0
7f41f6068000-7f41f6267000 ---p 00009000 08:04 2229711                    /usr/lib/x86_64-linux-gnu/libltdl.so.7.3.0
7f41f6267000-7f41f6268000 r--p 00008000 08:04 2229711                    /usr/lib/x86_64-linux-gnu/libltdl.so.7.3.0
7f41f6268000-7f41f6269000 rw-p 00009000 08:04 2229711                    /usr/lib/x86_64-linux-gnu/libltdl.so.7.3.0
7f41f6269000-7f41f62b4000 r-xp 00000000 08:04 2228864                    /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2.8.3Aborted (core dumped)

Change History (12)

comment:1 by neteler, 12 years ago

There seems to be a (wild) mixture of buffer lengths for the raster map title:

Compare:

in reply to:  1 comment:2 by Nikos Alexandris, 12 years ago

Replying to neteler:

There seems to be a (wild) mixture of buffer lengths for the raster map title:
Compare:

Interesting mixture :-). If it is not possible to equalise all these, maybe, at the very least, warn the user to "conform" to a fixed length and below, and not letting him to a scary seg-fault?

comment:3 by martinl, 9 years ago

Milestone: 7.0.07.0.5

comment:4 by martinl, 8 years ago

Description: modified (diff)

comment:5 by martinl, 8 years ago

To reproduce the bug please attach spearfish_landcover_30m.psmap file

comment:6 by martinl, 8 years ago

Milestone: 7.0.57.3.0

comment:7 by martinl, 8 years ago

Milestone: 7.3.07.4.0

Milestone renamed

comment:8 by neteler, 7 years ago

Milestone: 7.4.07.4.1

Ticket retargeted after milestone closed

comment:9 by neteler, 6 years ago

Milestone: 7.4.17.4.2

comment:10 by martinl, 6 years ago

Milestone: 7.4.27.6.0

All enhancement tickets should be assigned to 7.6 milestone.

comment:11 by martinl, 6 years ago

Milestone: 7.6.07.6.1

Ticket retargeted after milestone closed

comment:12 by martinl, 6 years ago

Milestone: 7.6.17.6.2

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.