diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2015-03-09 08:47:16 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2015-03-09 08:47:16 (GMT) |
commit | ce19753d87babcd578fbc9fb7b9329722e3a604c (patch) | |
tree | befd99d086b9ad13476ba30ffd805d8f9b084bb3 /src | |
parent | 5b294640c003dac45c2cc489793950207bf63c8f (diff) | |
parent | 2a4ea9b24e5d28598b627fca39fb42a9baedfaa3 (diff) | |
download | hdf5-ce19753d87babcd578fbc9fb7b9329722e3a604c.zip hdf5-ce19753d87babcd578fbc9fb7b9329722e3a604c.tar.gz hdf5-ce19753d87babcd578fbc9fb7b9329722e3a604c.tar.bz2 |
[svn-r26396] Merge of r26349-26392 from the trunk.
Tested on: h5committest
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/H5.c | 89 | ||||
-rw-r--r-- | src/H5HG.c | 4 | ||||
-rw-r--r-- | src/H5HGpkg.h | 6 | ||||
-rw-r--r-- | src/H5MM.c | 121 | ||||
-rw-r--r-- | src/H5MMprivate.h | 6 | ||||
-rw-r--r-- | src/H5Oalloc.c | 2 | ||||
-rw-r--r-- | src/H5PL.c | 83 | ||||
-rw-r--r-- | src/H5PLextern.h | 12 | ||||
-rw-r--r-- | src/H5PLprivate.h | 15 | ||||
-rw-r--r-- | src/H5PLpublic.h | 53 | ||||
-rw-r--r-- | src/H5R.c | 13 | ||||
-rw-r--r-- | src/H5Zfletcher32.c | 4 | ||||
-rw-r--r-- | src/H5detect.c | 17 | ||||
-rw-r--r-- | src/H5public.h | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/hdf5.h | 3 |
17 files changed, 310 insertions, 123 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d9e7195..999420c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -482,6 +482,7 @@ set (H5PL_SRCS set (H5PL_HDRS ${HDF5_SRC_DIR}/H5PLextern.h + ${HDF5_SRC_DIR}/H5PLpublic.h ) IDE_GENERATED_PROPERTIES ("H5PL" "${H5PL_HDRS}" "${H5PL_SRCS}" ) @@ -860,27 +860,109 @@ H5close(void) /*------------------------------------------------------------------------- + * Function: H5allocate_memory + * + * Purpose: Allocate a memory buffer with the semantics of malloc(). + * + * NOTE: This function is intended for use with filter + * plugins so that all allocation and free operations + * use the same memory allocator. It is not intended for + * use as a general memory allocator in applications. + * + * Parameters: + * + * size: The size of the buffer. + * + * clear: Whether or not to memset the buffer to 0. + * + * Return: + * + * Success: A pointer to the allocated buffer. + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5allocate_memory(size_t size, hbool_t clear) +{ + void *ret_value = NULL; + + FUNC_ENTER_API_NOINIT; + H5TRACE2("*x", "zb", size, clear); + + if(clear) + ret_value = H5MM_calloc(size); + else + ret_value = H5MM_malloc(size); + + FUNC_LEAVE_API(ret_value) + +} /* end H5allocate_memory() */ + + +/*------------------------------------------------------------------------- + * Function: H5resize_memory + * + * Purpose: Resize a memory buffer with the semantics of realloc(). + * + * NOTE: This function is intended for use with filter + * plugins so that all allocation and free operations + * use the same memory allocator. It is not intended for + * use as a general memory allocator in applications. + * + * Parameters: + * + * mem: The buffer to be resized. + * + * size: The size of the buffer. + * + * Return: + * + * Success: A pointer to the resized buffer. + * + * Failure: NULL (the input buffer will be unchanged) + * + *------------------------------------------------------------------------- + */ +void * +H5resize_memory(void *mem, size_t size) +{ + void *ret_value = NULL; + + FUNC_ENTER_API_NOINIT; + H5TRACE2("*x", "*xz", mem, size); + + ret_value = H5MM_realloc(mem, size); + + FUNC_LEAVE_API(ret_value) + +} /* end H5resize_memory() */ + + +/*------------------------------------------------------------------------- * Function: H5free_memory * - * Purpose: Frees memory allocated by the library that it is the user's + * Purpose: Frees memory allocated by the library that it is the user's * responsibility to free. Ensures that the same library * that was used to allocate the memory frees it. Passing * NULL pointers is allowed. * - * Return: SUCCEED/FAIL + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5free_memory(void *mem) { - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_NOINIT; H5TRACE1("e", "*x", mem); /* At this time, it is impossible for this to fail. */ HDfree(mem); FUNC_LEAVE_API(SUCCEED) + } /* end H5free_memory() */ @@ -944,3 +1026,4 @@ DllMain(_In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved) return fOkay; } #endif /* H5_HAVE_WIN32_API && H5_BUILT_AS_DYNAMIC_LIB && H5_HAVE_WIN_THREADS && H5_HAVE_THREADSAFE*/ + @@ -182,7 +182,7 @@ HDmemset(heap->chunk, 0, size); * which was always at least H5HG_ALIGNMENT aligned then we could just * align the pointer, but this might not be the case. */ - n = H5HG_ALIGN(p - heap->chunk) - (p - heap->chunk); + n = H5HG_ALIGN(p - heap->chunk) - (size_t)(p - heap->chunk); #ifdef OLD_WAY /* Don't bother zeroing out the rest of the info in the heap -QAK */ HDmemset(p, 0, n); @@ -776,7 +776,7 @@ H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) else heap->obj[0].size += need; HDmemmove(obj_start, obj_start + need, - heap->size - ((obj_start + need) - heap->chunk)); + heap->size - (size_t)((obj_start + need) - heap->chunk)); if(heap->obj[0].size >= H5HG_SIZEOF_OBJHDR(f)) { p = heap->obj[0].begin; UINT16ENCODE(p, 0); /*id*/ diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h index 5d4234f..274e0e3 100644 --- a/src/H5HGpkg.h +++ b/src/H5HGpkg.h @@ -77,7 +77,7 @@ H5FL_BLK_EXTERN(gheap_chunk); * largest data type is eight bytes. */ #define H5HG_ALIGNMENT 8 -#define H5HG_ALIGN(X) (H5HG_ALIGNMENT*(((X)+H5HG_ALIGNMENT-1)/ \ +#define H5HG_ALIGN(X) (size_t)(H5HG_ALIGNMENT*(((X)+H5HG_ALIGNMENT-1)/ \ H5HG_ALIGNMENT)) #define H5HG_ISALIGNED(X) ((X)==H5HG_ALIGN(X)) @@ -108,8 +108,8 @@ H5FL_BLK_EXTERN(gheap_chunk); * some overhead and each message has some overhead. The `+2' accounts for * rounding and for the free space object. */ -#define H5HG_NOBJS(f,z) (int)((((z)-H5HG_SIZEOF_HDR(f))/ \ - H5HG_SIZEOF_OBJHDR(f)+2)) +#define H5HG_NOBJS(f,z) ((((z)-H5HG_SIZEOF_HDR(f))/ \ + H5HG_SIZEOF_OBJHDR(f)+2)) /****************************/ @@ -31,93 +31,107 @@ #include "H5Eprivate.h" #include "H5MMprivate.h" -#ifndef NDEBUG /*------------------------------------------------------------------------- - * Function: H5MM_malloc + * Function: H5MM_malloc * - * Purpose: Just like the POSIX version of malloc(3). This routine - * specifically checks for allocations of 0 bytes and fails - * in that case. This routine is not called when NDEBUG is - * defined. + * Purpose: Similar to the C89 version of malloc(). * - * Return: Success: Ptr to new memory + * On size of 0, we return a NULL pointer instead of the + * standard-allowed 'special' pointer since that's more + * difficult to check as a return value. This is still + * considered an error condition since allocations of zero + * bytes usually indicate problems. + * + * Return: Success: Pointer new memory * - * Failure: NULL + * Failure: NULL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Nov 8 2003 - * - * Modifications: + * Programmer: Quincey Koziol + * Nov 8 2003 * *------------------------------------------------------------------------- */ void * H5MM_malloc(size_t size) { + void *ret_value; + + HDassert(size); + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(size); + if(size) + ret_value = HDmalloc(size); + else + ret_value = NULL; - FUNC_LEAVE_NOAPI(HDmalloc(size)); + FUNC_LEAVE_NOAPI(ret_value); } /* end H5MM_malloc() */ /*------------------------------------------------------------------------- - * Function: H5MM_calloc + * Function: H5MM_calloc * - * Purpose: Similar to the POSIX version of calloc(3), except this routine - * just takes a 'size' parameter. This routine - * specifically checks for allocations of 0 bytes and fails - * in that case. This routine is not called when NDEBUG is - * defined. + * Purpose: Similar to the C89 version of calloc(), except this + * routine just takes a 'size' parameter. * - * Return: Success: Ptr to new memory + * On size of 0, we return a NULL pointer instead of the + * standard-allowed 'special' pointer since that's more + * difficult to check as a return value. This is still + * considered an error condition since allocations of zero + * bytes usually indicate problems. * - * Failure: NULL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * Nov 8 2003 + * Return: Success: Pointer new memory * - * Modifications: + * Failure: NULL + * + * Programmer: Quincey Koziol + * Nov 8 2003 * *------------------------------------------------------------------------- */ void * H5MM_calloc(size_t size) { + void *ret_value; + + HDassert(size); + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(size); + if(size) + ret_value = HDcalloc((size_t)1, size); + else + ret_value = NULL; - FUNC_LEAVE_NOAPI(HDcalloc(1,size)); + FUNC_LEAVE_NOAPI(ret_value); } /* end H5MM_calloc() */ -#endif /* NDEBUG */ /*------------------------------------------------------------------------- - * Function: H5MM_realloc + * Function: H5MM_realloc * - * Purpose: Just like the POSIX version of realloc(3). Specifically, the - * following calls are equivalent + * Purpose: Similar semantics as C89's realloc(). Specifically, the + * following calls are equivalent: * - * H5MM_realloc (NULL, size) <==> H5MM_malloc (size) - * H5MM_realloc (ptr, 0) <==> H5MM_xfree (ptr) - * H5MM_realloc (NULL, 0) <==> NULL + * H5MM_realloc(NULL, size) <==> H5MM_malloc(size) + * H5MM_realloc(ptr, 0) <==> H5MM_xfree(ptr) + * H5MM_realloc(NULL, 0) <==> NULL * - * Return: Success: Ptr to new memory or NULL if the memory - * was freed or HDrealloc couldn't allocate - * memory. + * Note that the (NULL, 0) combination is undefined behavior + * in the C standard. * - * Failure: NULL + * Return: Success: Ptr to new memory if size > 0 + * NULL if size is zero * - * Programmer: Robb Matzke - * matzke@llnl.gov - * Jul 10 1997 + * Failure: NULL (input buffer is unchanged on failure) + * + * Programmer: Robb Matzke + * Jul 10 1997 * *------------------------------------------------------------------------- */ @@ -129,16 +143,19 @@ H5MM_realloc(void *mem, size_t size) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - if(NULL == mem) { - if(0 == size) + HDassert(mem || size); + + if(NULL == mem && 0 == size) { + /* Not defined in the standard, return NULL */ + ret_value = NULL; + } + else { + ret_value = HDrealloc(mem, size); + + /* Some platforms do not return NULL if size is zero. */ + if(0 == size) ret_value = NULL; - else - ret_value = H5MM_malloc(size); - } /* end if */ - else if(0 == size) - ret_value = H5MM_xfree(mem); - else - ret_value = HDrealloc(mem, size); + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5MM_realloc() */ diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h index a3c39f0..0d608b2 100644 --- a/src/H5MMprivate.h +++ b/src/H5MMprivate.h @@ -33,19 +33,13 @@ /* Private headers needed by this file */ #include "H5private.h" -#ifdef NDEBUG -#define H5MM_malloc(Z) HDmalloc(Z) -#define H5MM_calloc(Z) HDcalloc((size_t)1,Z) -#endif /* NDEBUG */ #define H5MM_free(Z) HDfree(Z) /* * Library prototypes... */ -#ifndef NDEBUG H5_DLL void *H5MM_malloc(size_t size); H5_DLL void *H5MM_calloc(size_t size); -#endif /* NDEBUG */ H5_DLL void *H5MM_realloc(void *mem, size_t size); H5_DLL char *H5MM_xstrdup(const char *s); H5_DLL char *H5MM_strdup(const char *s); diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 5c00fb2..76f392d 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -762,7 +762,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size, size_t *new size_t idx; /* Message number */ uint8_t *p = NULL; /*ptr into new chunk */ H5O_cont_t *cont = NULL; /*native continuation message */ - unsigned chunkno; /* Chunk allocated */ + size_t chunkno; /* Chunk allocated */ haddr_t new_chunk_addr; unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -97,6 +97,7 @@ typedef const void *(__cdecl *H5PL_get_plugin_info_t)(void); typedef const void *(*H5PL_get_plugin_info_t)(void); #endif /* H5_HAVE_WIN32_API */ +/* Whether to preload pathnames for plugin libraries */ #define H5PL_DEFAULT_PATH H5_DEFAULT_PLUGINDIR /* Special symbol to indicate no plugin loading */ @@ -149,8 +150,8 @@ static char *H5PL_path_table_g[H5PL_MAX_PATH_NUM]; static size_t H5PL_num_paths_g = 0; static hbool_t H5PL_path_found_g = FALSE; -/* Whether to preload pathnames for plugin libraries */ -static hbool_t H5PL_no_plugin_g = FALSE; +/* Enable all plugin libraries */ +static unsigned int H5PL_plugin_g = H5PL_ALL_PLUGIN; /*-------------------------------------------------------------------------- @@ -177,7 +178,7 @@ H5PL__init_interface(void) if(NULL != (preload_path = HDgetenv("HDF5_PLUGIN_PRELOAD"))) { /* Special symbal "::" means no plugin during data reading. */ if(!HDstrcmp(preload_path, H5PL_NO_PLUGIN)) - H5PL_no_plugin_g = TRUE; + H5PL_plugin_g = 0; } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -185,31 +186,68 @@ H5PL__init_interface(void) /*------------------------------------------------------------------------- - * Function: H5PL_no_plugin + * Function: H5PLset_loading_state * - * Purpose: Quick way for filter module to query whether to load plugin + * Purpose: Control the loading of dynamic plugin types. * - * Return: TRUE: No plugin loading during data reading + * This function will not allow plugin types if the pathname from the HDF5_PLUGIN_PRELOAD + * environment variable is set to the special "::" string. * - * FALSE: Load plugin during data reading + * plugin bit = 0, will prevent the use of that dynamic plugin type. + * plugin bit = 1, will allow the use of that dynamic plugin type. * - * Programmer: Raymond Lu - * 20 February 2013 + * H5PL_TYPE_FILTER changes just dynamic filters + * A H5PL_ALL_PLUGIN will enable all dynamic plugin types + * A zero value will disable all dynamic plugin types + * + * Return: Non-negative or success * *------------------------------------------------------------------------- */ -htri_t -H5PL_no_plugin(void) +herr_t +H5PLset_loading_state(unsigned int plugin_type) { - htri_t ret_value; + char *preload_path; + herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API(FAIL) + H5TRACE1("e", "Iu", plugin_type); + /* change the bit value of the requested plugin type(s) */ + H5PL_plugin_g = plugin_type; + /* check if special ENV variable is set and disable all plugin types */ + if(NULL != (preload_path = HDgetenv("HDF5_PLUGIN_PRELOAD"))) { + /* Special symbol "::" means no plugin during data reading. */ + if(!HDstrcmp(preload_path, H5PL_NO_PLUGIN)) + H5PL_plugin_g = 0; + } +done: + FUNC_LEAVE_API(ret_value) +} /* end H5PLset_loading_state() */ - FUNC_ENTER_NOAPI(FAIL) - ret_value = (htri_t)H5PL_no_plugin_g; +/*------------------------------------------------------------------------- + * Function: H5PLget_loading_state + * + * Purpose: Query state of the loading of dynamic plugin types. + * + * This function will return the state of the global flag. + * + * Return: Zero if all plugin types are disabled, negative if all + * plugin types are enabled, positive if one or more of the plugin types are enabled. + * + *------------------------------------------------------------------------- + */ +herr_t +H5PLget_loading_state(unsigned int* plugin_type) +{ + herr_t ret_value = SUCCEED; /* Return value */ + FUNC_ENTER_API(FAIL) + + if(plugin_type) + *plugin_type = H5PL_plugin_g; + done: + FUNC_LEAVE_API(ret_value) +} /* end H5PLget_loading_state() */ -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5PL_no_plugin() */ /*------------------------------------------------------------------------- @@ -285,9 +323,14 @@ H5PL_load(H5PL_type_t type, int id) FUNC_ENTER_NOAPI(NULL) - /* Check for "no plugins" indicated" */ - if(H5PL_no_plugin_g) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin filter '%d' is not available", id) + switch (type) { + case H5PL_TYPE_FILTER: + if((H5PL_plugin_g & H5PL_FILTER_PLUGIN) == 0) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin filter '%d' is not available", id) + break; + default: + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "required dynamically loaded plugin '%d' is not valid", id) + } /* Initialize the location paths for dynamic libraries, if they aren't * already set up. diff --git a/src/H5PLextern.h b/src/H5PLextern.h index 8ad19e7..3264435 100644 --- a/src/H5PLextern.h +++ b/src/H5PLextern.h @@ -22,18 +22,6 @@ /* Include HDF5 header */ #include "hdf5.h" -/*******************/ -/* Public Typedefs */ -/*******************/ - -/* Plugin type */ -typedef enum H5PL_type_t { - H5PL_TYPE_ERROR = -1, /*error */ - H5PL_TYPE_FILTER = 0, /*filter */ - H5PL_TYPE_NONE = 1 /*this must be last! */ -} H5PL_type_t; - - /* plugins always export */ #if defined (_MSC_VER) /* MSVC Compiler Case */ #define H5PLUGIN_DLL __declspec(dllexport) diff --git a/src/H5PLprivate.h b/src/H5PLprivate.h index 587a51b..77e115b 100644 --- a/src/H5PLprivate.h +++ b/src/H5PLprivate.h @@ -19,18 +19,8 @@ #ifndef _H5PLprivate_H #define _H5PLprivate_H -/* Keep the following in sync with the package's "external" header */ - -/*******************/ -/* Public Typedefs */ -/*******************/ - -/* Plugin type */ -typedef enum H5PL_type_t { - H5PL_TYPE_ERROR = -1, /*error */ - H5PL_TYPE_FILTER = 0, /*filter */ - H5PL_TYPE_NONE = 1 /*this must be last! */ -} H5PL_type_t; +/* Include package's public header */ +#include "H5PLpublic.h" /* Private headers needed by this file */ #include "H5private.h" /* Generic Functions */ @@ -57,7 +47,6 @@ typedef enum H5PL_type_t { /* Internal API routines */ H5_DLL const void *H5PL_load(H5PL_type_t plugin_type, int type_id); -H5_DLL htri_t H5PL_no_plugin(void); #endif /* _H5PLprivate_H */ diff --git a/src/H5PLpublic.h b/src/H5PLpublic.h new file mode 100644 index 0000000..1dae3b7 --- /dev/null +++ b/src/H5PLpublic.h @@ -0,0 +1,53 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic document set and is * + * linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have access * + * to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Raymond Lu <songyulu@hdfgroup.org> + * 13 February 2013 + */ + +#ifndef _H5PLpublic_H +#define _H5PLpublic_H + +/* Public headers needed by this file */ +#include "H5public.h" /* Generic Functions */ + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/* Plugin type */ +typedef enum H5PL_type_t { + H5PL_TYPE_ERROR = -1, /*error */ + H5PL_TYPE_FILTER = 0, /*filter */ + H5PL_TYPE_NONE = 1 /*this must be last! */ +} H5PL_type_t; + +/* Common dynamic plugin type flags */ +#define H5PL_FILTER_PLUGIN 0x0001 +#define H5PL_ALL_PLUGIN 0xFFFF + +#ifdef __cplusplus +extern "C" { +#endif + +/* plugin state */ +H5_DLL herr_t H5PLset_loading_state(unsigned int plugin_type); +H5_DLL herr_t H5PLget_loading_state(unsigned int* plugin_type/*out*/); + +#ifdef __cplusplus +} +#endif + +#endif /* _H5PLpublic_H */ + @@ -411,6 +411,10 @@ done: 13 July 2011 I added the OAPL_ID parameter for the object being referenced. It only supports dataset access property list currently. + + M. Scot Breitenfeld + 3 March 2015 + Added a check for undefined reference pointer. --------------------------------------------------------------------------*/ hid_t H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type, const void *_ref, hbool_t app_ref) @@ -435,8 +439,10 @@ H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type, switch(ref_type) { case H5R_OBJECT: oloc.addr = *(const hobj_ref_t *)_ref; /* Only object references currently supported */ - break; - + if(!H5F_addr_defined(oloc.addr) || oloc.addr == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Undefined reference pointer") + break; + case H5R_DATASET_REGION: { H5HG_t hobjid; /* Heap object ID */ @@ -448,6 +454,9 @@ H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type, H5F_addr_decode(oloc.file, &p, &(hobjid.addr)); UINT32DECODE(p, hobjid.idx); + if(!H5F_addr_defined(hobjid.addr) || hobjid.addr == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Undefined reference pointer") + /* Get the dataset region from the heap (allocate inside routine) */ if(NULL == (buf = (uint8_t *)H5HG_read(oloc.file, dxpl_id, &hobjid, NULL, NULL))) HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information") diff --git a/src/H5Zfletcher32.c b/src/H5Zfletcher32.c index 7f67015..2ee69d1 100644 --- a/src/H5Zfletcher32.c +++ b/src/H5Zfletcher32.c @@ -137,9 +137,11 @@ H5Z_filter_fletcher32 (unsigned flags, size_t UNUSED cd_nelmts, const unsigned U /* Compute checksum (can't fail) */ fletcher = H5_checksum_fletcher32(src, nbytes); - if (NULL==(dst=outbuf=H5MM_malloc(nbytes+FLETCHER_LEN))) + if (NULL == (outbuf = H5MM_malloc(nbytes + FLETCHER_LEN))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate Fletcher32 checksum destination buffer") + dst = (unsigned char *) outbuf; + /* Copy raw data */ HDmemcpy((void*)dst, (void*)(*buf), nbytes); diff --git a/src/H5detect.c b/src/H5detect.c index b902af4..fc0570c 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -858,6 +858,7 @@ done:\n\ printf("/* signal_handlers tested: %d times */\n", signal_handler_tested_g); printf("/* sigbus_handler called: %d times */\n", sigbus_handler_called_g); printf("/* sigsegv_handler called: %d times */\n", sigsegv_handler_called_g); + printf("/* sigill_handler called: %d times */\n", sigill_handler_called_g); } /* end print_results() */ @@ -1750,13 +1751,17 @@ main(void) #if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) /* verify the SIGBUS and SIGSEGV handlers work properly */ - if (verify_signal_handlers (SIGBUS, sigbus_handler) != 0){ - fprintf(stderr, "Signal handler %s for signal %d failed\n", - "sigbus_handler", SIGBUS); + if (verify_signal_handlers(SIGBUS, sigbus_handler) != 0) { + fprintf(stderr, "Signal handler %s for signal %d failed\n", + "sigbus_handler", SIGBUS); } - if (verify_signal_handlers (SIGSEGV, sigsegv_handler) != 0){ - fprintf(stderr, "Signal handler %s for signal %d failed\n", - "sigsegv_handler", SIGSEGV); + if (verify_signal_handlers(SIGSEGV, sigsegv_handler) != 0) { + fprintf(stderr, "Signal handler %s for signal %d failed\n", + "sigsegv_handler", SIGSEGV); + } + if (verify_signal_handlers(SIGILL, sigill_handler) != 0) { + fprintf(stderr, "Signal handler %s for signal %d failed\n", + "sigill_handler", SIGILL); } #else align_status_g |= STA_NoHandlerVerify; diff --git a/src/H5public.h b/src/H5public.h index 673aa6f..0e866be 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -332,6 +332,8 @@ H5_DLL herr_t H5get_libversion(unsigned *majnum, unsigned *minnum, H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum, unsigned relnum); H5_DLL herr_t H5free_memory(void *mem); +H5_DLL void *H5allocate_memory(size_t size, hbool_t clear); +H5_DLL void *H5resize_memory(void *mem, size_t size); #ifdef __cplusplus } diff --git a/src/Makefile.am b/src/Makefile.am index 4b55144..2df095e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -119,7 +119,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers H5FDmulti.h H5FDsec2.h H5FDstdio.h \ H5Gpublic.h H5Ipublic.h H5Lpublic.h \ H5MMpublic.h H5Opublic.h H5Ppublic.h \ - H5PLextern.h \ + H5PLextern.h H5PLpublic.h \ H5Rpublic.h H5Spublic.h \ H5Tpublic.h H5Zpublic.h @@ -33,7 +33,8 @@ #include "H5Lpublic.h" /* Links */ #include "H5MMpublic.h" /* Memory management */ #include "H5Opublic.h" /* Object headers */ -#include "H5Ppublic.h" /* Property lists */ +#include "H5Ppublic.h" /* Property lists */ +#include "H5PLpublic.h" /* Plugins */ #include "H5Rpublic.h" /* References */ #include "H5Spublic.h" /* Dataspaces */ #include "H5Tpublic.h" /* Datatypes */ |