GalSim-developers/GalSim — pull request #463 by rmjarvis (2013-08-28 20:46:29+00:00)
Title: #461 Fix bug in Image class resize function

Reiko found a potentially quite hazardous bug in the Image class. The usual use of resize is to allow for an Image to be constructed with no memory allocation and then later resized for some Bounds. This worked fine.

The bug was when an Image that already had some memory allocated is resized to some larger size. The logic in the resize function was wrong, so this would have resulted in undefined behavior. Since this isn't a use case we ever did, we didn't catch it in our unit tests.

Anyway, I fixed the problem, and added some unit tests to make sure it works correctly.