Commit c5ec0855 authored by Ole Streicher's avatar Ole Streicher

Update upstream source from tag 'upstream/4.19'

Update to upstream version '4.19'
with Debian dir 083ac48054d3527e6a3bd9078aeada8ca85d93a4
parents c8139263 1b9162a8
......@@ -134,6 +134,8 @@ DESCRIPTION:
- Column name (TTYPEn) does not exist or contains characters
other than letter, digit and underscore
- Calculated checksum inconsistent with CHECKSUM or DATASUM keyword
- Row length or heap offset greater than signed int max for
'P' format variable length columns.
This is the stand alone version of the FTOOLS 'fverify' program. It is
maintained by the HEASARC at NASA/GSFC. Any comments about this program
......
......@@ -108,12 +108,6 @@ HISTORY
long totalerr, totalwrn;
#ifdef STANDALONE
#include "fitsverify.c"
#else
#include "headas_main.c"
#endif
/* Function Prototypes */
int ftverify (void);
int ftverify_getpar (char *infile, char *outfile,int * prehead,
......@@ -123,6 +117,12 @@ int ftverify_work (char *infile, char *outfile,int prehead,
int prstat, char* errreport, int testdata, int testcsum,
int testfill, int heasarc_conv);
#ifdef STANDALONE
#include "fitsverify.c"
#else
#include "headas_main.c"
#endif
int err_report=0;
int prhead=0;
int prstat=1;
......@@ -242,12 +242,16 @@ int ftverify_work(
/* call work function to verify that infile conforms to the FITS
standard and write report to the output file */
{
#ifdef WEBTOOL
FILE *runfile = 0;
int runnum;
char runchars[30];
#endif
FILE *outfptr = 0;
FILE *list=0;
int status = 0, vfstatus = 0, filestatus, runnum;
int status = 0, vfstatus = 0, filestatus;
char * p;
char task[80],runchars[30];
char task[80];
char tversion[80];
float fversion;
int i, nerrs, nwarns;
......
......@@ -12,7 +12,7 @@
#define MAXWRNS 200
static char errmes[256];
static char comm[256];
static char comm[FLEN_FILENAME+6];
extern int prhead;
extern int testdata;
extern int testfill;
......@@ -138,7 +138,7 @@ void key_match(char **strs, int nstr, char **pattern, int exact,
int *ikey, int *mkey);
void test_colnam(FILE *out, FitsHdu *hduptr);
void parse_vtform(fitsfile *infits, FILE *out, FitsHdu *hduptr,
int colnum, int *datacode, long *maxlen);
int colnum, int *datacode, long *maxlen, int *isQFormat);
void print_title(FILE* out, int hdunum, int hdutype);
void print_header(FILE* out);
void print_summary(fitsfile *infits, FILE *out, FitsHdu *hduptr);
......
......@@ -62,6 +62,8 @@ void test_data(fitsfile *infits, /* input fits file */
int ndesc = 0;
int *desclist; /* the list of column which is the descriptor of
the variable length array. */
int *isVarQFormat; /* Format type for each of the ndesc variable-length
columns: 0 = type 'P', 1 = type 'Q' */
long rows_per_loop = 0, offset;
UserIter usrdata;
......@@ -99,6 +101,9 @@ void test_data(fitsfile *infits, /* input fits file */
int find_badchar = 0;
int find_badlog = 0;
LONGLONG naxis2;
int largeVarLengthWarned = 0;
int largeVarOffsetWarned = 0;
if(testcsum)
test_checksum(infits,out);
......@@ -131,7 +136,7 @@ void test_data(fitsfile *infits, /* input fits file */
floatlist =(int*)malloc(ncols * sizeof(int));
cmplist =(int*)malloc(ncols * sizeof(int));
txtlist =(int*)malloc(ncols * sizeof(int));
desclist =(int*)malloc(ncols * sizeof(int));
desclist =(int*)malloc(ncols * sizeof(int));
if(hduptr->hdutype == ASCII_TBL) {
......@@ -264,6 +269,7 @@ void test_data(fitsfile *infits, /* input fits file */
if(niter>0) free(iter_col);
free(numlist);
free(floatlist);
free(cmplist);
free(txtlist);
if(nnum > 0) free(usrdata.mask);
......@@ -285,6 +291,7 @@ void test_data(fitsfile *infits, /* input fits file */
maxlen = (long *) calloc(ndesc , sizeof(long));
dflag = (int *) calloc(ndesc , sizeof(int));
perbyte = (int *) calloc(ndesc , sizeof(int));
isVarQFormat = (int *) calloc(ndesc , sizeof(int));
fits_get_num_rows(infits,&totalrows,&status);
status = 0;
......@@ -294,7 +301,7 @@ void test_data(fitsfile *infits, /* input fits file */
for (i = 0; i < ndesc; i++) {
icol = desclist[i];
parse_vtform(infits,out,hduptr,icol,&datatype,&maxlen[i]);
parse_vtform(infits,out,hduptr,icol,&datatype,&maxlen[i],&isVarQFormat[i]);
dflag[i] = 4;
switch (datatype) {
case -TBIT:
......@@ -357,7 +364,27 @@ void test_data(fitsfile *infits, /* input fits file */
sprintf(errtmp,"Row #%ld Col.#%d: ",jl,icol);
wrtferr(out,errtmp,&status,2);
}
}
if (!isVarQFormat[i])
{
if (!largeVarLengthWarned && length > 2147483647)
{
strcpy(errmes,"Var row length exceeds maximum 32-bit signed int. ");
sprintf(errtmp,"First detected for Row #%ld Column #%d",jl,icol);
strcat(errmes,errtmp);
wrtwrn(out,errmes,0);
largeVarLengthWarned = 1;
}
if (!largeVarOffsetWarned && toffset > 2147483647)
{
strcpy(errmes,"Heap offset for var length row exceeds maximum 32-bit signed int. ");
sprintf(errtmp,"First detected for Row #%ld Column #%d",jl,icol);
strcat(errmes,errtmp);
wrtwrn(out,errmes,0);
largeVarOffsetWarned = 1;
}
}
if(length > maxlen[i] && maxlen[i] > -1 ) {
sprintf(errmes, "Descriptor of Column #%d at Row %ld: ",
icol, jl);
......@@ -473,6 +500,7 @@ void test_data(fitsfile *infits, /* input fits file */
free(maxlen);
free(dflag);
free(perbyte);
free(isVarQFormat);
data_end:
free(desclist);
......
......@@ -2771,7 +2771,8 @@ void parse_vtform(fitsfile *infits,
FitsHdu *hduptr,
int colnum, /* column number */
int* datacode, /* data code */
long* maxlen /* maximum length of the vector */
long* maxlen, /* maximum length of the vector */
int* isQFormat /* true if var col is 'Q' format */
)
{
int i = 0;
......@@ -2796,7 +2797,8 @@ void parse_vtform(fitsfile *infits,
"TFORM%d is not for the variable length array: %s.",
colnum, tform[colnum-1]);
wrterr(out,errmes,1);
}
}
*isQFormat = (*p == 'Q') ? 1 : 0;
fits_get_coltype(infits,colnum, datacode, NULL, NULL, &status);
status = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment