Opened 2 years ago

Closed 2 years ago

#335 closed defect - FPE (fixed)

poorly formated line list causes segfault

Reported by: Gary J. Ferland Owned by: nobody
Priority: blocker Milestone: C17_branch
Component: input parser Version: trunk
Keywords: Cc:

Description

The following causes a segfault:

test.in:

test
save line list "test.lin" "linelist_h.old"

lineslist_h.old:
 # new linefile
 H  1 6562.85A
 Ca B 6562.85A

The linelist file has a leading space, a common error when lines are copy/pated from the output.

The segfault:

Program received signal SIGSEGV, Segmentation fault.
0x000000000040ec28 in t_LineSave::wavelength (this=0x128cc60 <LineSave>,
    index=4575657221408423936) at ../lines.h:146
146			return m_wavelength[index];
Missing separate debuginfos, use: debuginfo-install glibc-2.17-78.el7.x86_64 libgcc-4.8.3-9.el7.x86_64 libstdc++-4.8.3-9.el7.x86_64


(gdb) print index
$1 = 4575657221408423936

The array index is way too large. We need to detect and exit gracefully from this user input format error.

Attachments (2)

test.in (48 bytes) - added by Gary J. Ferland 2 years ago.
input
linelist_h.old (2.9 KB) - added by Gary J. Ferland 2 years ago.
line list file with formatting problem

Download all attachments as: .zip

Change History (3)

Changed 2 years ago by Gary J. Ferland

Attachment: test.in added

input

Changed 2 years ago by Gary J. Ferland

Attachment: linelist_h.old added

line list file with formatting problem

comment:1 Changed 2 years ago by rjrw

Resolution: fixed
Status: newclosed

r10493 avoids the SEGV, and prints as helpful an error message as is possible given the input to findline()

Note: See TracTickets for help on using tickets.