diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-02-05 03:07:41 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-02-05 03:07:41 (GMT) |
commit | 5eb19fc5294620aaddfa2ae2c5b22cf93568dc0c (patch) | |
tree | 0adae783df20f313aef4bfbf2a54b05aeccd295e /src/H5Shyper.c | |
parent | 1a9136720e3e64a5dd8ad29344821ebef3f45fd2 (diff) | |
download | hdf5-5eb19fc5294620aaddfa2ae2c5b22cf93568dc0c.zip hdf5-5eb19fc5294620aaddfa2ae2c5b22cf93568dc0c.tar.gz hdf5-5eb19fc5294620aaddfa2ae2c5b22cf93568dc0c.tar.bz2 |
[svn-r18213] Description:
Bring r18212 from trunk to 1.8 branch:
Bring revisions from Coverity fixing branch to trunk:
r18184:
Fixed Coverity issue 373. Allocated memory freed in line 762 in case of error.
r18185:
Fixed Coverity issues 357 & 358. Added check for NULL pointer before use.
r18186:
Fix coverity item 65. Added code to h5unjam to correctly handle failures in
read() and write, and also to correctly handle writes that write less than
requested.
r18187:
Fix coverity items 115 and 116. Added code to H5Tenum.c to correctly close
opened datatypes in case of failure.
r18188:
Fixed Coverity issue 46. Check that dataset->shared is not null when freeing
memory after error.
r18190:
Fix coverity item 95. Added code to H5T_create_vlen to correctly close
allocated datatype in case of failure.
r18191:
Fixed Coverity error 59. Checked sfirst for -1 value before use in line 10533.
r18192:
Fix Coverity items 121 and 28
Added Asserts:
121: assert that all dimensions of count have values greater than zero.
28: assert curr_span pointer is not null before dereference.
Note: still need too add checks in hyperslab APIs that fail
when count values are zero, and appropriate tests.
r18194:
Fixed Coverity issues 61 & 62. Checked variable snpoints for value < 0 in line
218.
Tested on:
Mac OS X/32 10.6.2 (amazon) w/debug & production
(already daily tested on coverity branch)
Diffstat (limited to 'src/H5Shyper.c')
-rw-r--r-- | src/H5Shyper.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 857df97..ea37e40 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -5450,6 +5450,8 @@ H5S_hyper_make_spans (unsigned rank, const hsize_t *start, const hsize_t *stride head = NULL; last_span = NULL; + HDassert(count[i] > 0); + /* Generate all the span segments for this dimension */ for(u = 0, stride_iter = 0; u < count[i]; u++, stride_iter += stride[i]) { /* Allocate a span node */ @@ -7492,23 +7494,26 @@ H5S_hyper_get_seq_list_gen(const H5S_t *space,H5S_sel_iter_t *iter, partial_done: /* Yes, goto's are evil, so sue me... :-) */ /* Perform the I/O on the elements, based on the position of the iterator */ - while(io_bytes_left>0 && curr_seq<maxseq) { + while(io_bytes_left > 0 && curr_seq < maxseq) { + /* Sanity check */ + HDassert(curr_span); + /* Adjust location offset of destination to compensate for initial increment below */ - loc_off-=curr_span->pstride; + loc_off -= curr_span->pstride; /* Loop over all the spans in the fastest changing dimension */ - while(curr_span!=NULL) { + while(curr_span != NULL) { /* Move location offset of destination */ - loc_off+=curr_span->pstride; + loc_off += curr_span->pstride; /* Compute the number of elements to attempt in this span */ - H5_ASSIGN_OVERFLOW(span_size,curr_span->nelem,hsize_t,size_t); + H5_ASSIGN_OVERFLOW(span_size, curr_span->nelem, hsize_t, size_t); /* Check number of elements against upper bounds allowed */ - if(span_size>=io_bytes_left) { + if(span_size >= io_bytes_left) { /* Trim the number of bytes to output */ - span_size=io_bytes_left; - io_bytes_left=0; + span_size = io_bytes_left; + io_bytes_left = 0; /* COMMON */ /* Store the I/O information for the span */ |