From 25caae8d70adfa82beeb5ec1401f931ae1c5ec6d Mon Sep 17 00:00:00 2001 From: =?utf8?q?B=C3=A9la=20Vo=C3=9F?= Date: Thu, 27 Aug 2015 13:34:16 +0200 Subject: [PATCH] Avoid integer overflow in gmx_wham by using gmx_int64_t. somce gmx_wham internally uses femtoseconds, a cast to int can lead to overflows in microsecond timescale simulations. Change-Id: Ib7589c3c1ce47b29b3ada458b85bf577b41996d1 --- src/gromacs/gmxana/gmx_wham.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gromacs/gmxana/gmx_wham.cpp b/src/gromacs/gmxana/gmx_wham.cpp index 2504bc1808..89fef335f0 100644 --- a/src/gromacs/gmxana/gmx_wham.cpp +++ b/src/gromacs/gmxana/gmx_wham.cpp @@ -3,7 +3,7 @@ * * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team. - * Copyright (c) 2013,2014, by the GROMACS development team, led by + * Copyright (c) 2013-2015, by the GROMACS development team, led by * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, * and including many others, as listed in the AUTHORS file in the * top-level source directory and at http://www.gromacs.org. @@ -641,7 +641,7 @@ void read_pdo_data(FILE * file, t_UmbrellaHeader * header, sscanf(ptr, fmtlf, &time); /* printf("Time %f\n",time); */ /* Round time to fs */ - time = 1.0/1000*( static_cast (time*1000+0.5) ); + time = 1.0/1000*( static_cast (time*1000+0.5) ); /* get time step of pdo file */ if (count == 0) @@ -2269,7 +2269,7 @@ void read_pull_xf(const char *fn, const char *fntpr, t_UmbrellaHeader * header, for (i = 0; i < nt; i++) { /* Do you want that time frame? */ - t = 1.0/1000*( static_cast ((y[0][i]*1000) + 0.5)); /* round time to fs */ + t = 1.0/1000*( static_cast ((y[0][i]*1000) + 0.5)); /* round time to fs */ /* get time step of pdo file and get dstep from opt->dt */ if (i == 0) -- 2.11.4.GIT