From ad19183b92efa9a7c8012e9e628f974de0d509ff Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sat, 19 Jan 2019 07:55:54 +0100 Subject: [PATCH] OpenCL: Fix heap buffer overflow Bug message from AddressSanitizer: ==6158==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7fffe774b7fc at pc 0x555557086b54 bp 0x7fffffffcee0 sp 0x7fffffffced8 READ of size 1 at 0x7fffe774b7fc thread T0 #0 0x555557086b53 in tesseract::HistogramRect(Pix*, int, int, int, int, int, int*) ../../../../../src/ccstruct/otsuthr.cpp:163 Signed-off-by: Stefan Weil --- src/opencl/openclwrapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opencl/openclwrapper.cpp b/src/opencl/openclwrapper.cpp index 7bbb71948c..70117bb4ce 100644 --- a/src/opencl/openclwrapper.cpp +++ b/src/opencl/openclwrapper.cpp @@ -1998,7 +1998,7 @@ static void populateTessScoreEvaluationInputData( } } - input->pix = pixCreate(input->width, input->height, 1); + input->pix = pixCreate(input->width, input->height, 8 * input->numChannels); } struct TessDeviceScore {