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:
(from redmine: issue id 2086, created on 2016-12-02 by gmxdefault, closed on 2017-01-20)
- Revision c848f4a4 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 b7817e2d 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