Re: grdmath problems

Joaquim Luis <[email protected]>
Newsgroups gmane.comp.gis.gmt.user
Message-ID <[email protected]>
My suggestion of using letters for grid names was only to eliminate the 
possibility that the problem could in a way lie on the guessing code 
that tells if an argument starting by a a number is in fact a file name 
(a string).

The fact that debug builds some times work well when the non-debug 
doesn't is an unfortunate and not so rare situation. Often it's due to 
non-initialized variables that are initialized to 0 on release builds 
but to some random number in debug mode. However, that does not seam to 
be case here.

Since the whole command is a bit long I wonder if this in not something 
related to the 'argv' pointer that is set by the compiler. This being 
true a shorter number of grdmath operations would not show the problem. 
On the other hand I'm curious to know if the issue still happens with 
GMT5 (a better workaround than -V). In my quick tests I was not able to 
make it happen.


Joaquim

> Joachim:
>
>
> I followed your advice:
> cd /usr/src/gmt-4.5.11
> export CFLAGS="-g -O0"
> sudo ./configure --enable-debug
> sudo make
>
> then I ran these again and still got the buffer overflow error:
>
> /usr/src/gmt-4.5.11/bin/grdmath -R0/10/0/10 -I1 X = 1.grd
> /usr/src/gmt-4.5.11/bin/grdmath -R0/10/0/10 -I1 X = 2.grd
> /usr/src/gmt-4.5.11/bin/grdmath 1.grd DUP DUP 10 LE 0.65 MUL EXCH DUP 
> DUP DUP 10 GT EXCH 20 LE MUL EXCH 10 SUB 10 DIV -0.05 MUL 0.65 ADD MUL 
> EXCH DUP DUP DUP 20 GT EXCH 30 LE MUL EXCH 20 SUB 10 DIV -0.07 MUL 
> 0.60 ADD MUL EXCH DUP DUP DUP 30 GT EXCH 40 LE MUL EXCH 30 SUB 10 DIV 
> -0.08 MUL 0.53 ADD MUL EXCH 40 GT 0.45 MUL ADD ADD ADD ADD 686 2.grd 
> DIV EXCH POW MUL = 3.grd
>
> The backtrace looks similar to before:
>
> osop@osop-displays2:~$ /usr/src/gmt-4.5.11/bin/grdmath 1.grd DUP DUP 
> 10 LE 0.65 MUL EXCH DUP DUP DUP 10 GT EXCH 20 LE MUL EXCH 10 SUB 10 
> DIV -0.05 MUL 0.65 ADD MUL EXCH DUP DUP DUP 20 GT EXCH 30 LE MUL EXCH 
> 20 SUB 10 DIV -0.07 MUL 0.60 ADD MUL EXCH DUP DUP DUP 30 GT EXCH 40 LE 
> MUL EXCH 30 SUB 10 DIV -0.08 MUL 0.53 ADD MUL EXCH 40 GT 0.45 MUL ADD 
> ADD ADD ADD 686 2.grd DIV EXCH POW MUL = 3.grd
> *** buffer overflow detected ***: /usr/src/gmt-4.5.11/bin/grdmath 
> terminated
> ======= Backtrace: =========
> /lib/x86_64-linux-gnu/libc.so.6(__fortify_fail+0x37)[0x7f2217ae5f47]
> /lib/x86_64-linux-gnu/libc.so.6(+0x109e40)[0x7f2217ae4e40]
> /lib/x86_64-linux-gnu/libc.so.6(+0x108d13)[0x7f2217ae3d13]
> /usr/src/gmt-4.5.11/bin/grdmath[0x41e286]
> /usr/src/gmt-4.5.11/bin/grdmath[0x40cd4a]
> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed)[0x7f22179fc76d]
> /usr/src/gmt-4.5.11/bin/grdmath[0x40f409]
> ======= Memory map: ========
> ...
> ...
>
>
> *Branden Christensen*
> The Seismo Guys Blog: http://www.osop.com.pa/blog/the-seismo-guys/
> Take a Virtual Tour: http://www.osop.com.pa/tour
> Sign up for the OSOP mailing list: 
> http://www.osop.com.pa/about/osop-mailing-list/
>
>
> To unsubscribe, send the message "signoff gmt-help" to 
> [email protected] 


To unsubscribe, send the message "signoff gmt-help" to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.