Crashes/memory problems with selections - Redmine #2086
Archive from user: Chris Neale
I am not sure if this is an error in gmx distance or simply an
indication that the program doesn’t fail gracefully when I do something
idiotic.
I have attached a .pdb file and a script for running gmx distance
commands that works on some selections but gives a memory allocation
error on other selections. I believe that all selections should be
valid.
More information is available here:
https://mailman-1.sys.kth.se/pipermail/gromacs.org\_gmx-users/2016-November/109623.html
*(from redmine: issue id 2086, created on 2016-12-02 by gmxdefault, closed on 2017-01-20)*
* Changesets:
* Revision c848f4a4b18eed9cd36d97a59d5d97f0cdd5ad4e by Teemu Murtola on 2016-12-07T01:03:01Z:
```
Fix use of position variables with plus/merge
If a selection contained a position variable (e.g., 'com of ...') that
was used more than once, and at least one of those uses was with
plus/merge, there were out-of-bounds memory writes. This was caused by
the internal position structure not getting fully initialized.
Incomplete initialization happens in all contexts with such variables,
but only plus/merge (and possibly permute) actually use the values that
remained uninitialized, which caused them to incorrectly compute the
amount of memory required to store the result.
Fixes part of #2086.
Change-Id: I016e796db268a11d557309935c02cbd1bc79a83c
```
* Revision b7817e2da7e2e4df1292e7bc3f4f5414a1a77999 by Teemu Murtola on 2016-12-08T16:21:56Z:
```
Fix possible memory error with long selections
If a selection was more than 1000 characters long and there was a
whitespace exactly at the 1000 point, a buffer overflow could occur.
Replaced the buffer with std::string, simplifying the code
significantly. Update the generated code to use a newer flex, which
also removes the need for some suppressions.
Should fix #2086.
Change-Id: I56513bcf5ee99f05ce144461740d0f868be10186
```
* Uploads:
* [gmxDistanceErrorFiles.tgz](/uploads/4aad370a13054c97685256693d92827b/gmxDistanceErrorFiles.tgz)
issue