summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2020-01-25 19:24:53 +0100
committerMarcus Meissner <marcus@jet.franken.de>2020-01-25 19:24:53 +0100
commit2c6563298ade70427775896b1f79e820f4e46348 (patch)
tree2f692f824935a6fd44a52468f1797b99e6f8ae67
parent8b0ec6d07a62a22586adb2b077612dd532996fa9 (diff)
downloadlibgphoto2-2c6563298ade70427775896b1f79e820f4e46348.tar.gz
added a check on the boundaries of the homo_h processing (ASAN)
Otherwise we read 1 entry before the array and 1 entry after.
-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++) {