Out-of-bounds, overflow and incorrect outputs in gmx spatial
While using gmx spatial I encountered multiple problems. After reading the source I also found multiple problems that corrupts the results of the analysis (especially the wrong number of grid counts and incorrect coordinates are problematic ones).
- Out-of-bound memory writes
- Confusing error message when the coordinate is exactly on the boundary (happens with .xtc files)
- Norm may become negative due to overflow
- Having negative iIGNOREOUTER (default -1) led to incorrect number of grid points
- The coordinates of the grid points were incorrect especially when iIGNOREOUTER is non-zero
- Norm calculation was incorrect
Attached patches should solve the problems.