summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2001-07-30 18:57:04 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2001-07-30 18:57:04 (GMT)
commit007668c16ae2f550446c14ae27cff569da6f38b7 (patch)
treeca4af4597746f61fdc8d1c99911fdad7f6e9953b /src
parent06791fbe958506f1c80888bb8f80c73e1528be44 (diff)
downloadhdf5-007668c16ae2f550446c14ae27cff569da6f38b7.zip
hdf5-007668c16ae2f550446c14ae27cff569da6f38b7.tar.gz
hdf5-007668c16ae2f550446c14ae27cff569da6f38b7.tar.bz2
[svn-r4276] 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 1b04a01..f8538ae 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -2029,9 +2029,9 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
/* 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 */
size_t amount_read; /* Amount to read at a time */
@@ -2055,7 +2055,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz
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;
@@ -2192,9 +2192,9 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
/* 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) {
@@ -2284,7 +2284,7 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
/* 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) {