dirac-institute / kbmod

KBMOD (Kernel-Based Moving Object Detection)
BSD 2-Clause "Simplified" License
40 stars 14 forks source link

Change int to uint64 to prevent overflow #630

Closed wilsonbb closed 1 month ago

wilsonbb commented 1 month ago

In a recent KBMOD run, we used an ImageStack of 198 images with pixel dimensions of 4563 x 4563.

When filling out the psi phi arrays in src/kbmod/search/psi_phi_array.cpp, we allocate an array of size 4122551862 (= 4563 x 4563 x 198)

We then iterate over the indices of that array with an int which has a max value of only 2147483647 on most systems. This then resorts in an overflow and segfault.

I switched to using a uint64_t since it is portable across systems.