Bug #847

double free or corruption of psbasemap -A option

Added by Dongdong almost 2 years ago. Updated almost 2 years ago.

Status:ClosedStart date:2016-01-13
Priority:NormalDue date:
Assignee:Paul% Done:

100%

Category:-
Target version:Candidate for next bugfix release
Affected version:5.2-svn Platform:

Description

$ gmt psbasemap -R0/10/0/10 -JX10c/5c -A
# Geographical coordinates for a (regular) rectangular plot domain outline polygon               
# Command : psbasemap -R0/10/0/10 -JX10c/5c -A 
...
...
*** Error in `gmt': double free or corruption (!prev): 0x0000000001b2f3d0 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7cfe1)[0x7f7a594f3fe1]
/opt/GMT-5.2.1/lib64/libgmt.so.5(GMT_free_segment+0x135)[0x7f7a63739395]
/opt/GMT-5.2.1/lib64/libgmt.so.5(GMT_free_table+0xe3)[0x7f7a6373c213]
/opt/GMT-5.2.1/lib64/libgmt.so.5(GMT_free_dataset_ptr+0x36)[0x7f7a6373d4b6]
/opt/GMT-5.2.1/lib64/libgmt.so.5(GMTAPI_destroy_data_ptr+0x6b)[0x7f7a636ee7bb]
/opt/GMT-5.2.1/lib64/libgmt.so.5(GMT_Garbage_Collection+0x23d)[0x7f7a636f363d]
/opt/GMT-5.2.1/lib64/libgmt.so.5(GMT_end_module+0x41)[0x7f7a637baf01]
/opt/GMT-5.2.1/lib64/libgmt.so.5(GMT_psbasemap+0x50d)[0x7f7a63925c5d]
/opt/GMT-5.2.1/lib64/libgmt.so.5(GMT_Call_Module+0xb0)[0x7f7a636f9490]
gmt(main+0x5e1)[0x4012b1]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f7a59498b15]
gmt[0x40153d]
======= Memory map: ========
00400000-00402000 r-xp 00000000 fd:03 1097337                            /opt/GMT-5.2.1/bin/gmt
00602000-00603000 r--p 00002000 fd:03 1097337                            /opt/GMT-5.2.1/bin/gmt
00603000-00604000 rw-p 00003000 fd:03 1097337                            /opt/GMT-5.2.1/bin/gmt
01ad3000-01b55000 rw-p 00000000 00:00 0                                  [heap]
7f7a44000000-7f7a44021000 rw-p 00000000 00:00 0 
7f7a44021000-7f7a48000000 ---p 00000000 00:00 0 
7f7a4bb27000-7f7a4bc58000 rw-p 00000000 00:00 0 
7f7a4bc58000-7f7a4bc5a000 r-xp 00000000 fd:00 33608142                   /usr/lib64/libfreebl3.so
7f7a4bc5a000-7f7a4be59000 ---p 00002000 fd:00 33608142                   /usr/lib64/libfreebl3.so
7f7a4be59000-7f7a4be5a000 r--p 00001000 fd:00 33608142                   /usr/lib64/libfreebl3.so
7f7a4be5a000-7f7a4be5b000 rw-p 00002000 fd:00 33608142                   /usr/lib64/libfreebl3.so[1]    5195 abort      gmt psbasemap -R0/10/0/10 -JX10c/5c -A

Associated revisions

Revision 15460
Added by Paul almost 2 years ago

Did not allocate enough space for psbasemap -A, see issue #847

History

#1 Updated by Remko almost 2 years ago

  • Status changed from New to Feedback

I could not duplicate this in the current 5.2-svn version (r15434). Hence I assume it has already been fixed some time ago.
Please try with the newer version and report back whether you face the problem still.

#2 Updated by Dongdong almost 2 years ago

I don't know how to get the 5.2-svn verison, so I just run

svn checkout svn://gmtserver.soest.hawaii.edu/gmt5/trunk gmt5-dev

and get the 5.3.0_r15446.

The problem still exists:

$ /opt/GMT5-dev/bin/gmt --version                         
5.3.0_r15446
$ /opt/GMT5-dev/bin/gmt psbasemap -R0/10/0/10 -JX10c/10c -A
*** Error in `/opt/GMT5-dev/bin/gmt': double free or corruption (!prev): 0x0000000001598480 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7cfe1)[0x7f35b0156fe1]
/opt/GMT5-dev/lib64/libgmt.so.5(GMT_free_segment+0x129)[0x7f35ba39e229]
/opt/GMT5-dev/lib64/libgmt.so.5(GMT_free_table+0x103[1]    25905 abort      /opt/GMT5-dev/bin/gmt psbasemap -R0/10/0/10 -JX10c/10c -A

BTW, I am using CentOS 7.2 64bit:

$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID:    CentOS
Description:    CentOS Linux release 7.2.1511 (Core) 
Release:    7.2.1511
Codename:    Core

and all the GMT dependencies (netcdf, fftw et. al.) are installed using yum.

#3 Updated by Joaquim almost 2 years ago

I can reproduce it on Windows too and it's not obvious where it comes from. It says heap is corrupted. I want to look at the Coverity report to see if they have a clue, but we have to wait till they solve the problem with their machine.

#4 Updated by Paul almost 2 years ago

Not crashing under OS X of course. I did find a bug (n_rows was off by one) and fixed that in r15447 (trunk). Perhaps you can see if this has any effect on the crash. I cannot see anything else wrong, yet.

#5 Updated by Joaquim almost 2 years ago

Nope, it still crashes but now on a different place. It does so at the GMT_free() call in gmt_io.c L6851. Same accusation, heap is corrupted.

for (col = 0; col < segment→n_columns; col++) GMT_free (GMT, segment→coord[col]);

#6 Updated by Paul almost 2 years ago

  • Status changed from Feedback to Resolved
  • Assignee set to Paul
  • Target version set to Candidate for next bugfix release
  • % Done changed from 0 to 100

Did not allocate enough space for -A. Fixed in r15461.

#7 Updated by Joaquim almost 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF