[svn-r603] Changes since 19980818

----------------------

./src/H5.c
        Fixed an argument promotion bug in HDfprintf()

./src/H5Fistore.c
        Fixed a array bounds read error.

./src/H5HG.c
        Fixed uninitialized (but unused) data appearing in the hdf5
        file, a potential security problem.

./src/H5T.c
./src/H5Tpublic.h
        Added new data types for hdf5 types: H5T_NATIVE_HSIZE,
        H5T_NATIVE_HSSIZE, H5T_NATIVE_HERR, and H5T_NATIVE_HBOOL. I
        did not add H5T_NATIVE_HID since I couldn't think of a reason
        that it would be stored in a file anyway.
This commit is contained in:
Robb Matzke 1998-08-18 18:19:27 -05:00
parent da3fcf286a
commit 93e5190bb1
9 changed files with 657 additions and 627 deletions

File diff suppressed because it is too large Load Diff

View File

@ -695,7 +695,7 @@ HDfprintf (FILE *stream, const char *fmt, ...)
case 'c':
if (1) {
char x = va_arg (ap, char);
char x = (char)va_arg (ap, int);
n = fprintf (stream, template, x);
}
break;

View File

@ -877,7 +877,7 @@ H5F_istore_preempt (H5F_t *f, intn idx)
H5F_istore_flush_entry (f, ent, TRUE);
HDmemmove (rdcc->slot+idx, rdcc->slot+idx+1,
(rdcc->nused-idx) * sizeof(H5F_rdcc_ent_t));
(rdcc->nused-(idx+1)) * sizeof(H5F_rdcc_ent_t));
rdcc->nused -= 1;
rdcc->nbytes -= ent->chunk_size;
@ -911,9 +911,6 @@ H5F_istore_dest (H5F_t *f)
FUNC_ENTER (H5F_istore_dest, FAIL);
for (i=rdcc->nused-1; i>=0; --i) {
if (H5F_istore_flush_entry (f, rdcc->slot+i, TRUE)<0) {
nerrors++;
}
if (H5F_istore_preempt(f, i)<0) {
nerrors++;
}

View File

@ -877,7 +877,7 @@ H5F_istore_preempt (H5F_t *f, intn idx)
H5F_istore_flush_entry (f, ent, TRUE);
HDmemmove (rdcc->slot+idx, rdcc->slot+idx+1,
(rdcc->nused-idx) * sizeof(H5F_rdcc_ent_t));
(rdcc->nused-(idx+1)) * sizeof(H5F_rdcc_ent_t));
rdcc->nused -= 1;
rdcc->nbytes -= ent->chunk_size;
@ -911,9 +911,6 @@ H5F_istore_dest (H5F_t *f)
FUNC_ENTER (H5F_istore_dest, FAIL);
for (i=rdcc->nused-1; i>=0; --i) {
if (H5F_istore_flush_entry (f, rdcc->slot+i, TRUE)<0) {
nerrors++;
}
if (H5F_istore_preempt(f, i)<0) {
nerrors++;
}

View File

@ -142,7 +142,7 @@ H5HG_create (H5F_t *f, size_t size)
UINT16ENCODE(p, 0); /*reference count*/
UINT32ENCODE(p, 0); /*reserved*/
H5F_encode_length (f, p, heap->obj[0].size);
HDmemset (p, 0, (size_t)((heap->chunk+heap->nalloc) - p));
HDmemset (p, 0, (size_t)((heap->chunk+heap->size) - p));
/* Add the heap to the cache */
if (H5AC_set (f, H5AC_GHEAP, &addr, heap)<0) {

View File

@ -87,7 +87,10 @@ hid_t H5T_NATIVE_B16_g = FAIL;
hid_t H5T_NATIVE_B32_g = FAIL;
hid_t H5T_NATIVE_B64_g = FAIL;
hid_t H5T_NATIVE_OPAQUE_g = FAIL;
hid_t H5T_NATIVE_HSIZE_g = FAIL;
hid_t H5T_NATIVE_HSSIZE_g = FAIL;
hid_t H5T_NATIVE_HERR_g = FAIL;
hid_t H5T_NATIVE_HBOOL_g = FAIL;
/* The path database */
static intn H5T_npath_g = 0; /*num paths defined */
@ -187,7 +190,35 @@ H5T_init_interface(void)
HRETURN_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL,
"unable to initialize H5T layer");
}
/* hsize_t */
dt = H5I_object (H5T_NATIVE_HSIZE_g = H5Tcopy (H5T_NATIVE_UINT_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = sizeof(hsize_t);
dt->u.atomic.prec = 8*dt->size;
dt->u.atomic.offset = 0;
/* hssize_t */
dt = H5I_object (H5T_NATIVE_HSSIZE_g = H5Tcopy (H5T_NATIVE_INT_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = sizeof(hssize_t);
dt->u.atomic.prec = 8*dt->size;
dt->u.atomic.offset = 0;
/* herr_t */
dt = H5I_object (H5T_NATIVE_HERR_g = H5Tcopy (H5T_NATIVE_INT_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = sizeof(herr_t);
dt->u.atomic.prec = 8*dt->size;
dt->u.atomic.offset = 0;
/* hbool_t */
dt = H5I_object (H5T_NATIVE_HBOOL_g = H5Tcopy (H5T_NATIVE_INT_g));
dt->state = H5T_STATE_IMMUTABLE;
dt->size = sizeof(hbool_t);
dt->u.atomic.prec = 8*dt->size;
dt->u.atomic.offset = 0;
/*------------------------------------------------------------
* IEEE Types
*------------------------------------------------------------

View File

@ -342,6 +342,10 @@ extern hid_t H5T_FORTRAN_S1_g;
#define H5T_NATIVE_B32 (H5open(), H5T_NATIVE_B32_g)
#define H5T_NATIVE_B64 (H5open(), H5T_NATIVE_B64_g)
#define H5T_NATIVE_OPAQUE (H5open(), H5T_NATIVE_OPAQUE_g)
#define H5T_NATIVE_HSIZE (H5open(), H5T_NATIVE_HSIZE_g)
#define H5T_NATIVE_HSSIZE (H5open(), H5T_NATIVE_HSSIZE_g)
#define H5T_NATIVE_HERR (H5open(), H5T_NATIVE_HERR_g)
#define H5T_NATIVE_HBOOL (H5open(), H5T_NATIVE_HBOOL_g)
extern hid_t H5T_NATIVE_CHAR_g;
extern hid_t H5T_NATIVE_UCHAR_g;
extern hid_t H5T_NATIVE_SHORT_g;
@ -360,8 +364,11 @@ extern hid_t H5T_NATIVE_B16_g;
extern hid_t H5T_NATIVE_B32_g;
extern hid_t H5T_NATIVE_B64_g;
extern hid_t H5T_NATIVE_OPAQUE_g;
extern hid_t H5T_NATIVE_HSIZE_g;
extern hid_t H5T_NATIVE_HSSIZE_g;
extern hid_t H5T_NATIVE_HERR_g;
extern hid_t H5T_NATIVE_HBOOL_g;
/* Operations defined on all data types */
hid_t H5Topen (hid_t loc_id, const char *name);
hid_t H5Tcreate (H5T_class_t type, size_t size);

View File

@ -423,28 +423,6 @@ mtime.o: \
../src/H5Spublic.h \
../src/H5Tpublic.h \
../src/H5private.h
dsets.o: \
dsets.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
../src/H5Ipublic.h \
../src/H5Apublic.h \
../src/H5ACpublic.h \
../src/H5Bpublic.h \
../src/H5Dpublic.h \
../src/H5Epublic.h \
../src/H5Fpublic.h \
../src/H5Gpublic.h \
../src/H5HGpublic.h \
../src/H5HLpublic.h \
../src/H5MFpublic.h \
../src/H5MMpublic.h \
../src/H5Opublic.h \
../src/H5Ppublic.h \
../src/H5Zpublic.h \
../src/H5Spublic.h \
../src/H5Tpublic.h
links.o: \
links.c \
../src/hdf5.h \
@ -494,3 +472,25 @@ dtypes.o: \
../src/H5Fprivate.h \
../src/H5private.h \
../src/H5Tprivate.h
dsets.o: \
dsets.c \
../src/hdf5.h \
../src/H5public.h \
../src/H5config.h \
../src/H5Ipublic.h \
../src/H5Apublic.h \
../src/H5ACpublic.h \
../src/H5Bpublic.h \
../src/H5Dpublic.h \
../src/H5Epublic.h \
../src/H5Fpublic.h \
../src/H5Gpublic.h \
../src/H5HGpublic.h \
../src/H5HLpublic.h \
../src/H5MFpublic.h \
../src/H5MMpublic.h \
../src/H5Opublic.h \
../src/H5Ppublic.h \
../src/H5Zpublic.h \
../src/H5Spublic.h \
../src/H5Tpublic.h

View File

@ -814,8 +814,6 @@ main(void)
H5Gset_comment(grp, ".", "Causes diagnostic messages to be emitted");
H5Gclose (grp);
status = test_create(file);
nerrors += status < 0 ? 1 : 0;
@ -824,7 +822,7 @@ main(void)
status = test_tconv(file);
nerrors += status < 0 ? 1 : 0;
status = test_compression(file);
nerrors += status < 0 ? 1 : 0;