aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-03-03 16:33:53 +0100
committerThomas White <taw@physics.org>2010-03-03 16:33:53 +0100
commit8dccbd05b33baac364b3f40a88d18809df0f0e13 (patch)
tree7557183f253e10cd90f13c2d51dc7ef0020cf8b2
parent9c000b5df1d57499e9f4ca91f1b298f9f0f8c965 (diff)
Don't overrun image array boundaries
-rw-r--r--src/peaks.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/peaks.c b/src/peaks.c
index 506263b2..7e368100 100644
--- a/src/peaks.c
+++ b/src/peaks.c
@@ -360,10 +360,10 @@ void search_peaks(struct image *image)
did_something = 0;
for ( sy=biggest(mask_y-PEAK_WINDOW_SIZE/2, 0);
- sy<smallest(mask_y+PEAK_WINDOW_SIZE/2, height);
+ sy<smallest(mask_y+PEAK_WINDOW_SIZE/2, height-1);
sy++ ) {
for ( sx=biggest(mask_x-PEAK_WINDOW_SIZE/2, 0);
- sx<smallest(mask_x+PEAK_WINDOW_SIZE/2, width);
+ sx<smallest(mask_x+PEAK_WINDOW_SIZE/2, width-1);
sx++ ) {
if ( data[sx+width*sy] > max ) {