From 73e14702dd808da0d5b28596944dd306ff0af186 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Sat, 8 Apr 2017 10:13:53 +0200 Subject: [PATCH] fix out-of-bounds access to crop when lcp distortion correction is enabled --- rtengine/dcrop.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 0bc6ce82a..18cb927aa 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1150,10 +1150,10 @@ bool Crop::setCropSizes (int rcx, int rcy, int rcw, int rch, int skip, bool inte // distortion relative to the image // size. BUT IS 15% REALLY ENOUGH? // In fact, is there a better way?? - orw = min(int(orw + dW), parent->fw); - orh = min(int(orh + dH), parent->fh); orx = max(int(orx - dW/2.0), 0); ory = max(int(ory - dH/2.0), 0); + orw = min(int(orw + dW), parent->fw - orx); + orh = min(int(orh + dH), parent->fh - ory); }