Discussion:
pscoast: GMT_non_zero_winding given non-closed polygon
Hamish
2014-08-20 09:06:42 UTC
Permalink
Hi,

with regard to these earlier threads about problems with pscoast on
newer versions of Ubuntu and Debian,

http://gmt.soest.hawaii.edu/boards/1/topics/730
http://thread.gmane.org/gmane.comp.gis.gmt.user/21512

"""
*** Error in `pscoast': double free or corruption (!prev):
0x00000000025099f0 *** Aborted
"""

I'd like to point to these bug reports:

https://bugs.debian.org/758685
https://bugs.launchpad.net/ubuntu/+source/gmt/+bug/1349718

which include a full backtrace I did just now.

note current version of the GSHHS packages there are 2.2.0, and *.cdf
versions are shipped as part of the gmt-gshhs-{low|high|full} packages.

https://packages.debian.org/sid/all/gmt-gshhs-low/filelist

our compile flags and patches are stored here:
http://anonscm.debian.org/cgit/pkg-grass/gmt.git/tree/debian?id=debian/4.5.12-1

The patches are not that interesting, just replacing C++ style comments
with /* C */ versions. The compile flag setup can be found in the
debian/rules file at the above git tree browser, and the
proof-in-the-pudding of what compiler flags were used can be found in
the actual build log:

https://buildd.debian.org/status/fetch.php?pkg=gmt&arch=amd64&ver=4.5.12-1&stamp=1395314222

basically it boils down to:

gcc -fPIC -ansi -pedantic -O2 -I/usr/include \
-DGMT_SHARE_PATH=\"/usr/lib/gmt/share\" -DGMT_GSHHG_PATH=\"no\" [...]


I tried various things like replacing the coastline files with the
latest GSHHG 2.3.2, and downgrading the default version in configure.ac
(as far as I can see that is just for a string in a warning message),
but no luck, get the same thing. Identical gshhs 2.2.0 cdf files work
fine with GMT 4.5.7 from Debian/stable (wheezy). The trouble started
somewhere between there and Ubuntu 14.04 (GMT 4.5.11).


One wild theory that occurs to me is that instead of the gshhs version
mismatch I was assuming, it is instead the new hardening flags forcing
the program to bail instead of continuing on in an insecure state? So
the double-free() might be real? (??)



thanks,
Hamish
(DebianGIS team)

ps- I notice in 4.5.11 (ubuntu 14.04) when running a filled contour as
part of the MB-System example scripts the GMT map output is creating
vertical streaks from the patches (in matlab plotting sense) down to
the lower x-axis of the plot window. Is that a known bug? I can provide
more details if needed.

Mailing list for GMT discussions of all kinds. If you are not sure you have found a bug, discuss it here first.
To formally report bugs or request features, please register and add New Issue on gmt.soest.hawaii.edu
To unsubscribe, send the message "signoff gmt-help" to ***@lists.hawaii.edu
Note: gmt-help will become obsolete on Sept 1, 2014 - please use forum on gmt.soest.hawaii.edu instead.
J. Luis
2014-08-20 15:23:19 UTC
Permalink
Hamish,

Thanks for this extended test. I would also say that the double free
does indeed seams to exist but it's so strange that I don't catch it
with MSVC that is way more picky with those things than gcc or clang.
Also, did you try with GMT5? Our GMT5 test suite can (and is time to
time) be run under valgrind, which is supposed to catch these type of
problems.

Joaquim
Post by Hamish
Hi,
with regard to these earlier threads about problems with pscoast on
newer versions of Ubuntu and Debian,
http://gmt.soest.hawaii.edu/boards/1/topics/730
http://thread.gmane.org/gmane.comp.gis.gmt.user/21512
"""
0x00000000025099f0 *** Aborted
"""
https://bugs.debian.org/758685
https://bugs.launchpad.net/ubuntu/+source/gmt/+bug/1349718
which include a full backtrace I did just now.
note current version of the GSHHS packages there are 2.2.0, and *.cdf
versions are shipped as part of the gmt-gshhs-{low|high|full} packages.
https://packages.debian.org/sid/all/gmt-gshhs-low/filelist
http://anonscm.debian.org/cgit/pkg-grass/gmt.git/tree/debian?id=debian/4.5.12-1
The patches are not that interesting, just replacing C++ style comments
with /* C */ versions. The compile flag setup can be found in the
debian/rules file at the above git tree browser, and the
proof-in-the-pudding of what compiler flags were used can be found in
https://buildd.debian.org/status/fetch.php?pkg=gmt&arch=amd64&ver=4.5.12-1&stamp=1395314222
gcc -fPIC -ansi -pedantic -O2 -I/usr/include \
-DGMT_SHARE_PATH=\"/usr/lib/gmt/share\" -DGMT_GSHHG_PATH=\"no\" [...]
I tried various things like replacing the coastline files with the
latest GSHHG 2.3.2, and downgrading the default version in configure.ac
(as far as I can see that is just for a string in a warning message),
but no luck, get the same thing. Identical gshhs 2.2.0 cdf files work
fine with GMT 4.5.7 from Debian/stable (wheezy). The trouble started
somewhere between there and Ubuntu 14.04 (GMT 4.5.11).
One wild theory that occurs to me is that instead of the gshhs version
mismatch I was assuming, it is instead the new hardening flags forcing
the program to bail instead of continuing on in an insecure state? So
the double-free() might be real? (??)
thanks,
Hamish
(DebianGIS team)
ps- I notice in 4.5.11 (ubuntu 14.04) when running a filled contour as
part of the MB-System example scripts the GMT map output is creating
vertical streaks from the patches (in matlab plotting sense) down to
the lower x-axis of the plot window. Is that a known bug? I can provide
more details if needed.
Mailing list for GMT discussions of all kinds. If you are not sure you have found a bug, discuss it here first.
To formally report bugs or request features, please register and add New Issue on gmt.soest.hawaii.edu
Note: gmt-help will become obsolete on Sept 1, 2014 - please use forum on gmt.soest.hawaii.edu instead.
Mailing list for GMT discussions of all kinds. If you are not sure you have found a bug, discuss it here first.
To formally report bugs or request features, please register and add New Issue on gmt.soest.hawaii.edu
To unsubscribe, send the message "signoff gmt-help" to ***@lists.hawaii.edu
Note: gmt-help will become obsolete on Sept 1, 2014 - please use forum on gmt.soest.hawaii.edu instead.
Hamish
2014-08-21 10:37:16 UTC
Permalink
Post by J. Luis
Thanks for this extended test. I would also say that the double free
does indeed seams to exist but it's so strange that I don't catch it
with MSVC that is way more picky with those things than gcc or clang.
Hi Joaquim,

The (-pedantic) Debian build log didn't see much either, but I doubt that would catch many Valgrind-style memory issues.

fwiw, here is all of what it complains about in 4.5.12:

gcc -fPIC -ansi -pedantic -O2 -I/«PKGBUILDDIR»/src -I/usr/include -c -o mgd77.o mgd77.c
mgd77.c: In function 'MGD77_Write_Header_Record_m77t':
mgd77.c:1859:2: warning: string length '575' is greater than the length '509' ISO C90 compilers are required to support [-Woverlength-strings]
GMT_fputs (MGD77T_HEADER, F->fp); GMT_fputs ("\n", F->fp);
^


gcc -fPIC -ansi -pedantic -O2 -I/«PKGBUILDDIR»/src -I/usr/include -c -o mgd77header.o mgd77header.c
mgd77header.c: In function 'main':
mgd77header.c:60:2: warning: ISO C90 forbids mixed declarations and code [-Wpedantic]
char *tvalue[MGD77_MAX_COLS], buffer[BUFSIZ], **list = NULL, name[BUFSIZ], value[BUFSIZ], params[BUFSIZ], hinfile[BUFSIZ], line[BUFSIZ];
^


gcc -fPIC -ansi -pedantic -O2 -I/«PKGBUILDDIR»/src -I/usr/include -c -o xgrid_textView.o xgrid_textView.c
xgrid_textView.c: In function 'scrollHorizontal':
xgrid_textView.c:330:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
int x = (int)call_data;
^
xgrid_textView.c: In function 'scrollVertical':
xgrid_textView.c:378:12: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
int y = (int)call_data;
^


All pretty clean on the whole!
Post by J. Luis
Also, did you try with GMT5? Our GMT5 test suite can (and is time to
time) be run under valgrind, which is supposed to catch these type of
problems.
Debian packaging for GMT5 + cmake has begun, but it is not ready yet:
(I tried)
http://anonscm.debian.org/cgit/pkg-grass/gmt.git/log/
http://article.gmane.org/gmane.linux.debian.gis/596
https://bugs.debian.org/747269


GMT5 is a goal for the next stable release of Debian, but the real problem here is for Ubuntu 14.04 LTS, which is already locked at
4.5.11 for the next 5+ years. We can backport patches and change
compiler settings, but we can only do upgraded versions in 3rd party
PPAs (i.e. UbuntuGIS's package & backports repository)

As it is the next release of OSGeo Live DVD is about to go to the
printers for FOSS4G 2014 with a broken GMT demo, which makes me sad.
:-(
http://live.osgeo.org


thanks & regards,
Hamish

Mailing list for GMT discussions of all kinds. If you are not sure you have found a bug, discuss it here first.
To formally report bugs or request features, please register and add New Issue on gmt.soest.hawaii.edu
To unsubscribe, send the message "signoff gmt-help" to ***@lists.hawaii.edu
Note: gmt-help will become obsolete on Sept 1, 2014 - please use forum on gmt.soest.hawaii.edu instead.
Loading...