From 603f0eb3b18b72b8fe85b6710c8c63fbb80330c8 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 4 Jan 2017 16:28:38 -0800 Subject: [PATCH] fix occasional crash in PNMImage::quick_filter_from() --- panda/src/pnmimage/pnm-image-filter.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/panda/src/pnmimage/pnm-image-filter.cxx b/panda/src/pnmimage/pnm-image-filter.cxx index ac57b20b23..63398ad3c1 100644 --- a/panda/src/pnmimage/pnm-image-filter.cxx +++ b/panda/src/pnmimage/pnm-image-filter.cxx @@ -696,7 +696,7 @@ box_filter_line(const PNMImage &image, // Get the final (partial) xel float x_contrib = x1 - (float)x_last; - if (x_contrib > 0.0001f) { + if (x_contrib > 0.0001f && x < image.get_x_size()) { box_filter_xel(image, x, y, x_contrib, y_contrib, color, pixel_count); } @@ -728,7 +728,7 @@ box_filter_region(const PNMImage &image, // Get the final (partial) row float y_contrib = y1 - (float)y_last; - if (y_contrib > 0.0001f) { + if (y_contrib > 0.0001f && y < image.get_y_size()) { box_filter_line(image, x0, y, x1, y_contrib, color, pixel_count); }