[gmx-developers] Memory allocation bug in g_traj (cvs + 3.3.1)

wolfram at picb.ac.cn wolfram at picb.ac.cn
Wed Jul 11 17:42:19 CEST 2007

Hello All,

I encountered a little (and easy to fix) bug in gmx_traj.c,
in cvs it is at line 571, in 3.3.1 line 553.
-> isize[i] = atndx[index0[0][i]+1] - atndx[index0[0][i]];
isize[i] can become negative in some cases what results in the attempt
to pass a negative number to sfree() and thus a crash.
This is easily fixed by just adding behind the above line.
if (isize[i] < 0)
  isize[i] = isize[i] * -1;


More information about the gromacs.org_gmx-developers mailing list