Skip to content

Commit

Permalink
Protect against coverage map going out-of-bounds with pixel ranges.
Browse files Browse the repository at this point in the history
  • Loading branch information
erykoff committed Mar 3, 2025
1 parent 6d89fff commit e66e3bb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions healsparse/healSparseMap.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,10 @@ def _update_values_pixel_ranges(self, pixel_ranges, value, operation, no_append)
# Compute the coverage pixels.
cov_pix_ranges = np.right_shift(pixel_ranges, self._cov_map.bit_shift)
# After the bit shift these pixel ranges are inclusive, not exclusive.
# But we also need to protect against an overrun at the high end.
if cov_pix_ranges[-1, 1] == len(self.coverage_mask):
cov_pix_ranges[-1, 1] = len(self.coverage_mask) - 1

cov_pix_to_set = hpg.pixel_ranges_to_pixels(cov_pix_ranges, inclusive=True)
cov_pix_to_set = np.unique(cov_pix_to_set)

Expand Down

0 comments on commit e66e3bb

Please sign in to comment.