Bug #906

Segmentation fault with -i option, then requested column is absent

Added by Michael over 1 year ago. Updated over 1 year ago.

Status:ClosedStart date:2016-05-15
Priority:NormalDue date:
Assignee:Paul% Done:

100%

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

Description

I check this on psxy, but think other programs also affected
echo "1 2"| /home/michael/tmp/gmt5/bin/gmt psxy -i0,3 -JX10c -R0/1/0/1 >/dev/null
ERROR: Caught signal number 11 (Segmentation fault) at
/home/michael/tmp/gmt5/lib64/libgmt.so.5(gmt_geo_to_xy_line+0x5e)[0x7ff694b06e94]
[0x0]
Stack backtrace:
/home/michael/tmp/gmt5/lib64/libgmt.so.5(sig_handler+0x1b1)[0x7ff6949a12c0]
/lib/libpthread.so.0(+0xf450)[0x7ff692817450]
/home/michael/tmp/gmt5/lib64/libgmt.so.5(gmt_geo_to_xy_line+0x5e)[0x7ff694b06e94]
/home/michael/tmp/gmt5/lib64/libgmt.so.5(GMT_psxy+0x7238)[0x7ff694d0ccc3]
/home/michael/tmp/gmt5/lib64/libgmt.so.5(GMT_Call_Module+0x2a3)[0x7ff6949bfd3d]
/home/michael/tmp/gmt5/bin/gmt(main+0x492)[0x401223]
/lib/libc.so.6(__libc_start_main+0xf0)[0x7ff692479fd0]
/home/michael/tmp/gmt5/bin/gmt[0x400cb9]

This is a bug.

Interpretation of absent data as NaN can be added as a feature, because some data files have variable number of columns. This often happens in files created from Excel datasheets.

Associated revisions

Revision 16447
Added by Paul over 1 year ago

Add checks on input file # of columns to address issue #906

History

#1 Updated by Joaquim over 1 year ago

  • Status changed from New to In Progress

It is a bug because it crashes instead of being catch as an user error.

#2 Updated by Paul over 1 year ago

  • Assignee set to Paul
  • Target version set to Candidate for next bugfix release

Reasonable behavior here should be an error when requested columns exceed number of input columns. Note that this number is known when binary tables are used but unknown for ASCII until we read the data. So it will be necessary to throw an error deep in the belly of GMT. I will see how this should be done.

#3 Updated by Michael over 1 year ago

ASCII files can contains a different number of columns in each row. In some cases more useful to interpret absent data in some of rows as NaN (or other value) instead of throw error. May be some flag to -i option?

#4 Updated by Paul over 1 year ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

For now I am mostly concerned with stopping execution if inadequate data or options have been applied. Thus, r16447 has added checks in programs that read tables. The record-by-record programs usually catch this problem as they process the records. GMT does not really handle variable-length data records as they do not match our paradigm.

#5 Updated by Paul over 1 year ago

  • Status changed from Resolved to Closed

Closed as fixed - reopen if there are other problems related to this.

Also available in: Atom PDF