From 2c6563298ade70427775896b1f79e820f4e46348 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sat, 25 Jan 2020 19:24:53 +0100 Subject: added a check on the boundaries of the homo_h processing (ASAN) Otherwise we read 1 entry before the array and 1 entry after. --- libgphoto2/ahd_bayer.c | 6 ++++-- 1 file 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++) { -- cgit v1.2.1