From c11465e46a1f8dd1acf2bcf8b1dbc7544abffcbc Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 12 Jun 2016 20:56:55 +0200 Subject: [PATCH] Fix segfault when Flatfield blur radius == 0 --- rtengine/rawimagesource.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index b6444dd83..9da266610 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -3042,10 +3042,17 @@ void RawImageSource::copyOriginalPixels(const RAWParams &raw, RawImage *src, Raw SSEFUNCTION void RawImageSource::cfaboxblur(RawImage *riFlatFile, float* cfablur, const int boxH, const int boxW) { + + if(boxW == 0 && boxH == 0) { // nothing to blur + memcpy(cfablur, riFlatFile->data[0], W*H*sizeof(float)); + return; + } + float *tmpBuffer = nullptr; float *cfatmp = nullptr; float *srcVertical = nullptr; + if(boxH > 0 && boxW > 0) { // we need a temporary buffer if we have to blur both directions tmpBuffer = (float (*)) calloc (H * W, sizeof * tmpBuffer); @@ -3065,7 +3072,6 @@ SSEFUNCTION void RawImageSource::cfaboxblur(RawImage *riFlatFile, float* cfablur srcVertical = cfatmp; } - #ifdef _OPENMP #pragma omp parallel #endif