summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-07-30 18:57:55 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-07-30 18:57:55 (GMT)
commit95a8875013c0ac82a3a977e0ad4a2f3c832b55a9 (patch)
tree60b40f73da418f353c552d587d957c7724cb77a4 /src
parente1d58d1a9acc2a4ac183100f6a46e2572b9feec8 (diff)
downloadhdf5-95a8875013c0ac82a3a977e0ad4a2f3c832b55a9.zip
hdf5-95a8875013c0ac82a3a977e0ad4a2f3c832b55a9.tar.gz
hdf5-95a8875013c0ac82a3a977e0ad4a2f3c832b55a9.tar.bz2
[svn-r4277] Purpose:
Bug Fix Description: In certain circumstances, raw data was inadvertantly attempted to be read from the metadata cache. This was caught with an assertion failure (i.e. core dump) in the development branch or an eventual sequence of errors in the release branch. Solution: Corrected off-by-one error in metadata caching code. Platforms tested: FreeBSD 4.3 (hawkwind)
Diffstat (limited to 'src')
-rw-r--r--src/H5FD.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/H5FD.c b/src/H5FD.c
index a10f3b6..779c82d 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -2023,9 +2023,9 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
/* Check if this information is in the metadata accumulator */
if((file->feature_flags&H5FD_FEAT_ACCUMULATE_METADATA) &&
- ((addr>=file->accum_loc && addr <=(file->accum_loc+file->accum_size))
- || ((addr+size)>=file->accum_loc && (addr+size)<=(file->accum_loc+file->accum_size))
- || (addr<file->accum_loc && (addr+size)>(file->accum_loc+file->accum_size)))) {
+ ((addr>=file->accum_loc && addr <(file->accum_loc+file->accum_size))
+ || ((addr+size)>file->accum_loc && (addr+size)<=(file->accum_loc+file->accum_size))
+ || (addr<file->accum_loc && (addr+size)>file->accum_loc))) {
unsigned char *read_buf=(unsigned char *)buf; /* Pointer to the buffer being read in */
hsize_t amount_read; /* Amount to read at a time */
@@ -2049,7 +2049,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t si
size-=amount_read;
} /* end if */
- /* Read the part overlapping the metadata accumulator */
+ /* Copy the part overlapping the metadata accumulator */
if(size>0 && (addr>=file->accum_loc && addr<(file->accum_loc+file->accum_size))) {
/* Set the offset to "read" from */
read_off=addr-file->accum_loc;
@@ -2187,9 +2187,9 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t s
/* Check if there is already metadata in the accumulator */
if(file->accum_size>0) {
/* Check if the piece of metadata being written adjoins or is inside the metadata accumulator */
- if((addr>=file->accum_loc && addr <=(file->accum_loc+file->accum_size))
- || ((addr+size)>=file->accum_loc && (addr+size)<=(file->accum_loc+file->accum_size))
- || (addr<file->accum_loc && (addr+size)>(file->accum_loc+file->accum_size))) {
+ if((addr>=file->accum_loc && addr <(file->accum_loc+file->accum_size))
+ || ((addr+size)>file->accum_loc && (addr+size)<=(file->accum_loc+file->accum_size))
+ || (addr<file->accum_loc && (addr+size)>file->accum_loc)) {
/* Check if the new metadata adjoins the beginning of the current accumulator */
if((addr+size)==file->accum_loc) {
@@ -2285,7 +2285,7 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t s
/* Check if the new metadata overlaps the end of the current accumulator */
else if(addr>=file->accum_loc && (addr+size)>(file->accum_loc+file->accum_size)) {
/* Calculate the new accumulator size, based on the amount of overlap */
- new_size=file->accum_size+((addr+size)-(file->accum_loc+file->accum_size));
+ new_size=(addr-file->accum_loc)+size;
/* Check if we need more buffer space */
if(new_size>file->accum_buf_size) {