summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2002-09-13 16:27:09 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2002-09-13 16:27:09 (GMT)
commitf0f56c0c0a708812294a6192aa1979efd3ccba6e (patch)
treeeed1f4047db983569c0349fea4429157c3a92fe2
parent208e59bab978f3a66a9a8752736b290de1b620dc (diff)
downloadhdf5-f0f56c0c0a708812294a6192aa1979efd3ccba6e.zip
hdf5-f0f56c0c0a708812294a6192aa1979efd3ccba6e.tar.gz
hdf5-f0f56c0c0a708812294a6192aa1979efd3ccba6e.tar.bz2
[svn-r5924] Purpose:
Code cleanup Description: Switch order of test on array bounds to avoid reading data outside of array Located by purify. Platforms tested: FreeBSD 4.6 (sleipnir) w/C++ Solaris 2.7 (arabica) w/C++ IRIX64 6.5 (modi4) w/parallel & fortran
-rw-r--r--src/H5Sselect.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/H5Sselect.c b/src/H5Sselect.c
index 70888e8..381e9e0 100644
--- a/src/H5Sselect.c
+++ b/src/H5Sselect.c
@@ -1237,7 +1237,7 @@ H5S_select_read(H5F_t *f, const H5O_layout_t *layout, H5P_genplist_t *dc_plist,
/* Determine how many file sequences will fit into current memory sequence */
tmp_file_len=0;
tot_file_seq=0;
- while((tmp_file_len+file_len[curr_file_seq])<=mem_len[curr_mem_seq] && curr_file_seq<file_nseq) {
+ while( curr_file_seq<file_nseq && (tmp_file_len+file_len[curr_file_seq])<=mem_len[curr_mem_seq] ) {
tmp_file_len+=file_len[curr_file_seq];
curr_file_seq++;
tot_file_seq++;
@@ -1467,7 +1467,7 @@ H5S_select_write(H5F_t *f, H5O_layout_t *layout, H5P_genplist_t *dc_plist,
/* Determine how many file sequences will fit into current memory sequence */
tmp_file_len=0;
tot_file_seq=0;
- while((tmp_file_len+file_len[curr_file_seq])<=mem_len[curr_mem_seq] && curr_file_seq<file_nseq) {
+ while( curr_file_seq<file_nseq && (tmp_file_len+file_len[curr_file_seq])<=mem_len[curr_mem_seq] ) {
tmp_file_len+=file_len[curr_file_seq];
curr_file_seq++;
tot_file_seq++;