biod.pnpi.spb.ru
/
alexxy
/
gromacs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a41668d
)
Avoid segfault when comparing tpr
author
Roland Schulz
<roland@utk.edu>
Mon, 3 Mar 2014 23:22:31 +0000
(18:22 -0500)
committer
Gerrit Code Review
<gerrit@gerrit.gromacs.org>
Wed, 5 Mar 2014 06:17:17 +0000
(07:17 +0100)
Segfault was possible if number of idef didn't match
Change-Id: I62315e3340eec8acf14c01d14917392bc63e46e0
src/gromacs/tools/compare.c
patch
|
blob
|
history
diff --git
a/src/gromacs/tools/compare.c
b/src/gromacs/tools/compare.c
index f5a231849e92a69d9c5499204fb348edcf1dcb80..cef2d70117b6d040895c7055adab9fbb0d05fbce 100644
(file)
--- a/
src/gromacs/tools/compare.c
+++ b/
src/gromacs/tools/compare.c
@@
-350,7
+350,7
@@
static void cmp_idef(FILE *fp, t_idef *id1, t_idef *id2, real ftol, real abstol)
{
cmp_int(fp, "idef->ntypes", -1, id1->ntypes, id2->ntypes);
cmp_int(fp, "idef->atnr", -1, id1->atnr, id2->atnr);
- for (i = 0; (i <
id1->ntypes
); i++)
+ for (i = 0; (i <
min(id1->ntypes, id2->ntypes)
); i++)
{
sprintf(buf1, "idef->functype[%d]", i);
sprintf(buf2, "idef->iparam[%d]", i);