[gmx-developers] trajectory handling crash on windows (4.6.*)

Mirco Wahab mirco.wahab at chemie.tu-freiberg.de
Thu Dec 5 21:13:35 CET 2013

src/gmxlib/gmxfio.c L.680

* internal variant of get_file_md5 that operates on a locked file */
static int gmx_fio_int_get_file_md5(t_fileio *fio, gmx_off_t offset,
                                     unsigned char digest[])
     /*1MB: large size important to catch almost identical files */
#define CPT_CHK_LEN  1048576
     md5_state_t   state;
     unsigned char buf[CPT_CHK_LEN];
     gmx_off_t     read_len;
     gmx_off_t     seek_offset;
     int           ret = -1;

The default stack size allocation Visual Studio 2012 is 1MB.
The above code therefore will lead to stack corruption in
some cases (it segfaulted).

Solution (on 4.6.5):

<     static unsigned char buf[CPT_CHK_LEN];
 >     unsigned char buf[CPT_CHK_LEN];

More information about the gromacs.org_gmx-developers mailing list