Fix bug causing reading next frame not to stop.
authorMagnus Lundborg <lundborg.magnus@gmail.com>
Tue, 1 Jul 2014 10:09:14 +0000 (12:09 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sat, 5 Jul 2014 12:37:09 +0000 (14:37 +0200)
Corresponds to commit e6e85d562829bca in the TNG repo.

Change-Id: I89ee3e7649c4cf832798d9e2ce61b397a1757579

src/external/tng_io/src/lib/tng_io.c

index fa4d3e55bfe39ed9e50311e773a35edf3bb7b466..d0028bd69fcd17cd1943608cb8c4a9eb0ed0b465 100644 (file)
@@ -17379,6 +17379,10 @@ tng_function_status DECLSPECDLLEXPORT tng_util_particle_data_next_frame_read
                 {
                     return(stat);
                 }
+                if(frame_set->first_frame + frame_set->n_frames - 1 < i)
+                {
+                    return(TNG_FAILURE);
+                }
                 i = frame_set->first_frame;
             }
         }
@@ -17539,6 +17543,10 @@ tng_function_status DECLSPECDLLEXPORT tng_util_non_particle_data_next_frame_read
                 {
                     return(stat);
                 }
+                if(frame_set->first_frame + frame_set->n_frames - 1 < i)
+                {
+                    return(TNG_FAILURE);
+                }
                 i = frame_set->first_frame;
             }
         }