summaryrefslogtreecommitdiffstats
path: root/hl/src/H5TB.c
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2014-09-24 21:56:47 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2014-09-24 21:56:47 (GMT)
commit0324181acc550459d21238759e4bbdf8c1cf37e5 (patch)
tree369bd7441dfc1eb880f6247cba4e57956e17675a /hl/src/H5TB.c
parentb2fa3069d939a95f0b642edbefe04c7a5209d1bd (diff)
downloadhdf5-0324181acc550459d21238759e4bbdf8c1cf37e5.zip
hdf5-0324181acc550459d21238759e4bbdf8c1cf37e5.tar.gz
hdf5-0324181acc550459d21238759e4bbdf8c1cf37e5.tar.bz2
[svn-r25614] Fixed HDFFV-8670
*H5DSis_scale and other HL APIs do not null terminate string (and other issues)
Diffstat (limited to 'hl/src/H5TB.c')
-rw-r--r--hl/src/H5TB.c105
1 files changed, 104 insertions, 1 deletions
diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c
index a1456ea..7856d5f 100644
--- a/hl/src/H5TB.c
+++ b/hl/src/H5TB.c
@@ -94,6 +94,17 @@ herr_t H5TBmake_table(const char *table_title,
hsize_t i;
herr_t ret_val = -1;
+ /* check the arguments */
+ if (table_title == NULL) {
+ goto out;
+ }
+ if (dset_name == NULL) {
+ goto out;
+ }
+ if (field_names == NULL) {
+ goto out;
+ }
+
dims[0] = nrecords;
dims_chunk[0] = chunk_size;
@@ -290,6 +301,10 @@ herr_t H5TBappend_records(hid_t loc_id,
hsize_t nfields;
herr_t ret_val = -1;
+ /* check the arguments */
+ if (dset_name == NULL)
+ goto out;
+
/* get the original number of records and fields */
if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords_orig) < 0)
goto out;
@@ -360,6 +375,10 @@ herr_t H5TBwrite_records(hid_t loc_id,
hsize_t dims[1];
herr_t ret_val = -1;
+ /* check the arguments */
+ if (dset_name == NULL)
+ goto out;
+
/* open the dataset. */
if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
@@ -459,6 +478,12 @@ herr_t H5TBwrite_fields_name(hid_t loc_id,
size_t size_native;
herr_t ret_val = -1;
+ /* check the arguments */
+ if (dset_name == NULL)
+ goto out;
+ if (field_names == NULL)
+ goto out;
+
/* create xfer properties to preserve initialized data */
if((preserve_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto out;
@@ -616,6 +641,10 @@ herr_t H5TBwrite_fields_index(hid_t loc_id,
char *member_name = NULL;
herr_t ret_val = -1;
+ /* check the arguments */
+ if (dset_name == NULL)
+ goto out;
+
/* create xfer properties to preserve initialized data */
if((preserve_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto out;
@@ -773,6 +802,10 @@ herr_t H5TBread_table(hid_t loc_id,
hsize_t dims[1];
herr_t ret_val = -1;
+ /* check the arguments */
+ if (dset_name == NULL)
+ goto out;
+
/* open the dataset. */
if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
@@ -846,6 +879,10 @@ herr_t H5TBread_records(hid_t loc_id,
hsize_t nfields;
herr_t ret_val = -1;
+ /* check the arguments */
+ if (dset_name == NULL)
+ goto out;
+
/* get the number of records and fields */
if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords_orig) < 0)
goto out;
@@ -922,6 +959,13 @@ herr_t H5TBread_fields_name(hid_t loc_id,
hssize_t i, j;
herr_t ret_val = -1;
+
+ /* check the arguments */
+ if (dset_name == NULL)
+ goto out;
+ if (field_names == NULL)
+ goto out;
+
/* open the dataset */
if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
@@ -1074,6 +1118,10 @@ herr_t H5TBread_fields_index(hid_t loc_id,
char *member_name = NULL;
herr_t ret_val = -1;
+ /* check the arguments */
+ if (dset_name == NULL)
+ goto out;
+
/* open the dataset. */
if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
@@ -1231,6 +1279,11 @@ herr_t H5TBdelete_record(hid_t loc_id,
unsigned char *tmp_buf = NULL;
herr_t ret_val = -1;
+
+ /* check the arguments */
+ if (dset_name == NULL)
+ goto out;
+
/*-------------------------------------------------------------------------
* first we get information about type size and offsets on disk
*-------------------------------------------------------------------------
@@ -1390,6 +1443,10 @@ herr_t H5TBinsert_record(hid_t loc_id,
unsigned char *tmp_buf = NULL;
herr_t ret_val = -1;
+ /* check the arguments */
+ if (dset_name == NULL)
+ goto out;
+
/*-------------------------------------------------------------------------
* read the records after the inserted one(s)
*-------------------------------------------------------------------------
@@ -1541,6 +1598,12 @@ herr_t H5TBadd_records_from(hid_t loc_id,
unsigned char *tmp_buf = NULL;
herr_t ret_val = -1;
+ /* check the arguments */
+ if (dset_name1 == NULL)
+ goto out;
+ if (dset_name2 == NULL)
+ goto out;
+
/*-------------------------------------------------------------------------
* first we get information about type size and offsets on disk
*-------------------------------------------------------------------------
@@ -1688,6 +1751,14 @@ herr_t H5TBcombine_tables(hid_t loc_id1,
htri_t has_fill;
herr_t ret_val = -1;
+ /* check the arguments */
+ if (dset_name1 == NULL)
+ goto out;
+ if (dset_name2 == NULL)
+ goto out;
+ if (dset_name3 == NULL)
+ goto out;
+
/*-------------------------------------------------------------------------
* first we get information about type size and offsets on disk
*-------------------------------------------------------------------------
@@ -2043,6 +2114,12 @@ herr_t H5TBinsert_field(hid_t loc_id,
hbool_t inserted;
herr_t ret_val = -1;
+ /* check the arguments */
+ if (dset_name == NULL)
+ goto out;
+ if (field_name == NULL)
+ goto out;
+
/* get the number of records and fields */
if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0)
goto out;
@@ -2451,6 +2528,13 @@ herr_t H5TBdelete_field(hid_t loc_id,
htri_t has_fill = FALSE;
herr_t ret_val = -1;
+
+ /* check the arguments */
+ if (dset_name == NULL)
+ goto out;
+ if (field_name == NULL)
+ goto out;
+
/* get the number of records and fields */
if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0)
goto out;
@@ -2859,6 +2943,7 @@ out:
herr_t H5TBAget_title(hid_t loc_id,
char *table_title)
{
+
/* Get the TITLE attribute */
if(H5LT_get_attribute_disk(loc_id, "TITLE", table_title) < 0)
return -1;
@@ -2894,6 +2979,10 @@ htri_t H5TBAget_fill(hid_t loc_id,
htri_t has_fill = FALSE;
htri_t ret_val = -1;
+ /* check the arguments */
+ if (dset_name == NULL)
+ goto out;
+
/* get the number of records and fields */
if(H5TBget_table_info(loc_id, dset_name, &nfields, &nrecords) < 0)
goto out;
@@ -2962,6 +3051,10 @@ herr_t H5TBget_table_info(hid_t loc_id,
int num_members;
herr_t ret_val = -1;
+ /* check the arguments */
+ if (dset_name == NULL)
+ goto out;
+
/* open the dataset. */
if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
@@ -3049,6 +3142,10 @@ herr_t H5TBget_field_info(hid_t loc_id,
hssize_t i;
herr_t ret_val = -1;
+ /* check the arguments */
+ if (dset_name == NULL)
+ goto out;
+
/* open the dataset. */
if((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0)
goto out;
@@ -3153,6 +3250,12 @@ hbool_t H5TB_find_field(const char *field, const char *field_list)
const char *start = field_list;
const char *end;
+ /* check the arguments */
+ if (field == NULL)
+ return FALSE;
+ if (field_list == NULL)
+ return FALSE;
+
while((end = HDstrstr(start, ",")) != 0) {
ptrdiff_t count = end - start;
@@ -3161,7 +3264,7 @@ hbool_t H5TB_find_field(const char *field, const char *field_list)
start = end + 1;
} /* end while */
- if(HDstrcmp(start, field) == 0)
+ if(HDstrncmp(start, field, HDstrlen(field)) == 0)
return TRUE;
return FALSE;