Bug #1806
"ref-t" for temperature coupling not validated
Description
Invalid values (e.g., letters, symbols, etc.) can be set as "ref-t" in an mdp file. When done so, GROMACS silently sets ref-t to 0.
Associated revisions
History
#1 Updated by James Barnett over 5 years ago
#2 Updated by Justin Lemkul over 5 years ago
- Priority changed from Normal to Low
Unfortunately this is the expected behavior of the strtod() function, and is also what e.g. atof() does - returns zero if it can't convert what is passed to it. We can't necessarily guard against a zero value, because that could be desired (albeit odd) for ref_t. Maybe a warning note? Not really a bug, just an unintended consequence of junk input.
#3 Updated by James Barnett over 5 years ago
Everything else seems to be validated. I'm working on a fix.
#4 Updated by Gerrit Code Review Bot over 5 years ago
Gerrit received a related patchset '1' for Issue #1806.
Uploader: James "Wes" Barnett (jbarnet4@tulane.edu)
Change-Id: Ia369c1f1ee809f6fbb9f43c31a1cb03cfc60fbce
Gerrit URL: https://gerrit.gromacs.org/4992
#5 Updated by Teemu Murtola over 5 years ago
Justin Lemkul wrote:
Unfortunately this is the expected behavior of the strtod() function, and is also what e.g. atof() does - returns zero if it can't convert what is passed to it.
No, this is just a consequence of not bothering to use the facilities that strtod() provides for input checking. And this is not the only field that has the same issue, either; searching for use of strtod() in readir.c(pp) shows several others as well.
#6 Updated by Erik Lindahl almost 5 years ago
- Status changed from New to Resolved
While this particular case is resolved, we should gradually move to a new (JSON?) format with proper checking of all values.
#7 Updated by Erik Lindahl almost 5 years ago
- Status changed from Resolved to Closed
Validate strings converted to numbers in mdp files
Check that strings converted by strtod() and strtol() only contain
numbers separated by spaces.
Resolves #1806.
Change-Id: Ia369c1f1ee809f6fbb9f43c31a1cb03cfc60fbce