aboutsummaryrefslogtreecommitdiff
path: root/src/intensities.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-11-30 14:55:20 +0100
committerThomas White <taw@physics.org>2009-11-30 14:55:20 +0100
commit2665467ebc745d5cea76ba9485671289a3a30389 (patch)
treeaf011432e6f2f395682ddc4df12e03afc3f199a2 /src/intensities.c
parentdc0cdc6d8e1bbd5afa112a183a2b7f0d8e5b1908 (diff)
Add bounds check
Diffstat (limited to 'src/intensities.c')
-rw-r--r--src/intensities.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/intensities.c b/src/intensities.c
index c70e63f7..ae8667cb 100644
--- a/src/intensities.c
+++ b/src/intensities.c
@@ -127,6 +127,13 @@ void output_intensities(struct image *image)
for ( i=0; i<n_hits; i++ ) {
int intensity;
+
+ /* Bounds check */
+ if ( hits[i].x + 3 >= image->width ) continue;
+ if ( hits[i].x - 3 < 0 ) continue;
+ if ( hits[i].y + 3 >= image->height ) continue;
+ if ( hits[i].y - 3 < 0 ) continue;
+
intensity = sum_nearby_points(image->data, image->width,
hits[i].x, hits[i].y);