From 4f73e5bb3cb4cbdd5749a8b7614319b65567cee8 Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Tue, 9 Jul 2019 00:20:04 +0200 Subject: [PATCH] Fix oob access in last commit --- rtengine/hilite_recon.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rtengine/hilite_recon.cc b/rtengine/hilite_recon.cc index b7c4d349c..e78bd7365 100644 --- a/rtengine/hilite_recon.cc +++ b/rtengine/hilite_recon.cc @@ -36,10 +36,10 @@ #include "StopWatch.h" namespace { -void boxblur2(const float* const* src, float** dst, float** temp, int startY, int startX, int H, int W, int box) +void boxblur2(const float* const* src, float** dst, float** temp, int startY, int startX, int H, int W, int bufferW, int box) { constexpr int numCols = 16; - assert((W % numCols) == 0); + assert((bufferW % numCols) == 0); //box blur image channel; box size = 2*box+1 //horizontal blur @@ -79,7 +79,7 @@ void boxblur2(const float* const* src, float** dst, float** temp, int startY, in #ifdef _OPENMP #pragma omp for #endif - for (int col = 0; col < W - numCols + 1; col += numCols) { + for (int col = 0; col < bufferW - numCols + 1; col += numCols) { float len = box + 1; for(int n = 0; n < numCols; n++) { tempvalN[n] = temp[0][col + n] / len; @@ -433,21 +433,21 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b // blur RGB channels - boxblur2(red, channelblur[0], temp, miny, minx, blurHeight, bufferWidth, 4); + boxblur2(red, channelblur[0], temp, miny, minx, blurHeight, blurWidth, bufferWidth, 4); if(plistener) { progress += 0.05; plistener->setProgress(progress); } - boxblur2(green, channelblur[1], temp, miny, minx, blurHeight, bufferWidth, 4); + boxblur2(green, channelblur[1], temp, miny, minx, blurHeight, blurWidth, bufferWidth, 4); if(plistener) { progress += 0.05; plistener->setProgress(progress); } - boxblur2(blue, channelblur[2], temp, miny, minx, blurHeight, bufferWidth, 4); + boxblur2(blue, channelblur[2], temp, miny, minx, blurHeight, blurWidth, bufferWidth, 4); if(plistener) { progress += 0.05; @@ -516,7 +516,7 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b array2D hilite_full4(bufferWidth, blurHeight); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //blur highlight data - boxblur2(hilite_full[3], hilite_full4, temp, 0, 0, blurHeight, bufferWidth, 1); + boxblur2(hilite_full[3], hilite_full4, temp, 0, 0, blurHeight, blurWidth, bufferWidth, 1); temp.free(); // free temporary buffer