summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libgphoto2/ahd_bayer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libgphoto2/ahd_bayer.c b/libgphoto2/ahd_bayer.c
index efedfd5ff..5254d28dc 100644
--- a/libgphoto2/ahd_bayer.c
+++ b/libgphoto2/ahd_bayer.c
@@ -581,8 +581,10 @@ int gp_ahd_interpolate (unsigned char *image, int w, int h, BayerTile tile)
for (i=-1; i < 2;i++) {
for (k=0; k < 3;k++) {
j=i+x+w*k;
- homo_ch[x]+=homo_h[j];
- homo_cv[x]+=homo_v[j];
+ if ((j >= 0) && ( j < w*3)) {
+ homo_ch[x]+=homo_h[j];
+ homo_cv[x]+=homo_v[j];
+ }
}
}
for (color=0; color < 3; color++) {