Build: #1 was successful
Job: Test Tools macOS 15 Py3.12 was successful
Code commits
CASA6
-
Rui Xue <rx.astro@gmail.com> 3000ee0fe103736833f139a6c7dbdf3eca4abb82
CAS-14622: Fix ncores-dependent tclean segmentation fault in `BriggsCubeWeightor`
The SynthesisImager uses `BriggsCubeWeightor` to compute weights for the image cube. During this calculation, `BriggsCubeWeightor::cube2Matrix` extracts raw storage pointers `pcube` and `pflags` from `casacore::Array::getStorage(deleteIt)`.
Previously, the code incremented these exact pointers (`*pflags = *pcube++`) during array traversal. At the end of the function, the incremented pointers were passed directly to `freeStorage()` and `putStorage()`.
When array memory isn't contiguous (which occurs when data is sliced across MPI ranks), `getStorage()` allocates a temporary buffer and sets `deleteIt = true`. Passing the shifted pointer into `freeStorage()` invokes `delete[]` on an invalid memory address, causing heap corruption and a Segmentation fault randomly depending on the data slicing.
This commit resolves the issue by securely caching the original pointers returned from `getStorage` into distinct variables. The traversal loops now use separate copies of these pointers, enabling the original allocation addresses to be correctly evaluated and freed by `freeStorage()` and `putStorage()`.