#348 closed defect (fixed)
psFitsReadTable() segfaults on valid input
| Reported by: | jhoblitt | Owned by: | |
|---|---|---|---|
| Priority: | highest | Milestone: | |
| Component: | types | Version: | 0.5.0 |
| Severity: | major | Keywords: | |
| Cc: |
Description
The code example below causes a segfault.
#include <pslib.h>
int main () {
psFits *f;
psArray *table;
f = psFitsAlloc("./phot.db");
move to first table
psFitsMoveExtNum(f, 1, false);
table = psFitsReadTable(f);
}
(gdb) bt
#0 ffgcls2 (fptr=0x63a250, colnum=0, firstrow=1, firstelem=1,
nelem=548682037311, nultyp=1, nulval=0x7fbfffeb9e "", array=0x7fbfffed20,
nularray=0x7fbfffeb9e "", anynul=0x7fbfffed1c, status=0x7fbfffee90)
at getcols.c:694
#1 0x00000000004443f1 in ffgcls (fptr=0x63a250, colnum=11, firstrow=1,
firstelem=1, nelem=1, nultyp=1, nulval=0x7fbfffeb9e "",
array=0x7fbfffed20, nularray=0x7fbfffeb9e "", anynul=0x7fbfffed1c,
status=0x7fbfffee90) at getcols.c:113
#2 0x000000000042d1b5 in ffgcv (fptr=0x63a250, datatype=6422690, colnum=11,
firstrow=548682037312, firstelem=63, nelem=63, nulval=0x0, array=0x0,
anynul=0x7fbfff7800, status=0x7fbfffee90) at getcol.c:796
#3 0x0000002a957c3600 in psFitsReadTableRow (fits=0x63c440, row=0)
at psFits.c:1214
#4 0x0000002a957c3fdf in psFitsReadTable (fits=0x63c440) at psFits.c:1451
#5 0x0000000000404fea in main ()
Attachments (1)
Change History (7)
by , 21 years ago
comment:2 by , 21 years ago
| Status: | new → assigned |
|---|
comment:3 by , 21 years ago
| Priority: | high → highest |
|---|
comment:4 by , 21 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Found the problem; I wasn't properly allocating a buffer for reading a string
element of a table.
Fix is in CVS.
-rdd

example fits file