From f6cb2579d0b012bfc6a095af39b276f312bc2942 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Tue, 22 Mar 2016 17:46:30 +0100 Subject: [PATCH] fix possible buffer overrun in raw ca correction --- rtengine/CA_correct_RT.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/CA_correct_RT.cc b/rtengine/CA_correct_RT.cc index b43e9177e..1796b7169 100644 --- a/rtengine/CA_correct_RT.cc +++ b/rtengine/CA_correct_RT.cc @@ -148,7 +148,7 @@ void RawImageSource::CA_correct_RT(const double cared, const double cablue, cons float *Gtmp = (float (*)) calloc ((height) * (width), sizeof * Gtmp); // temporary array to avoid race conflicts, only every second pixel needs to be saved here - float *RawDataTmp = (float*) malloc( height * width * sizeof(float) / 2); + float *RawDataTmp = (float*) malloc( (height * width + ((height * width) & 1)) * sizeof(float) / 2); float blockave[2][2] = {{0, 0}, {0, 0}}, blocksqave[2][2] = {{0, 0}, {0, 0}}, blockdenom[2][2] = {{0, 0}, {0, 0}}, blockvar[2][2];