From 6ba09ab9038542bd2e0107910e5cdd0285c000cc Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Fri, 19 Jul 2013 20:07:24 +1000 Subject: [PATCH] avoid reading beyond the end of the line buffer in rubthrough --- Changes | 7 +++++++ rubthru.im | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Changes b/Changes index 0fdeb44c..d7bfcfc5 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,12 @@ Imager release history. Older releases can be found in Changes.old + - when drawing on an image with an alpha channel where the source + minimum is greater than zero, Imager would read from beyond the end + of a malloc() allocated buffer. In rare circumstances this could + lead to some of the source image not being written to the target + image, or possibly to a segmentation fault. + I don't believe this has any security concerns beyond that. + Imager 0.97 - 15 Jul 2013 =========== diff --git a/rubthru.im b/rubthru.im index 8a2465f1..514ec09c 100644 --- a/rubthru.im +++ b/rubthru.im @@ -110,7 +110,7 @@ rubthru_targ_alpha(i_img *im, i_img *src, i_img_dim tx, i_img_dim ty, ++min_x; ++srcp; } - while (max_x > min_x && src_line[max_x-1].channel[alphachan] == 0) { + while (max_x > min_x && src_line[max_x-1 - src_minx].channel[alphachan] == 0) { --max_x; } -- 2.39.5