tesseract/src
Stefan Weil 3452c8ebee Fix out-of-bounds writes in Classify::ReadNewCutoffs
The function did not correctly read Chinese unichars into the local
Class variable if the locale was set to de_DE.UTF-8 (or other
incompatible locales). That resulted in a wrong ClassId which was
used to write into the Cutoffs array without checking for valid bounds.

On macOS the result was a runtime error in baseapi_test (see GitHub
issue #1250):

    [ RUN      ] TesseractTest.InitConfigOnlyTest
    baseapi_test(21845,0x1134c45c0) malloc: *** error for object 0x927f96c28005e0: pointer being freed was not allocated
    baseapi_test(21845,0x1134c45c0) malloc: *** set a breakpoint in malloc_error_break to debug

Replacing sscanf by std::istringstream fixes that.
Add also an assertion to catch future out-of-bounds writes.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2019-05-18 13:59:48 +02:00
..
api Remove space at line endings 2019-05-17 14:36:45 +02:00
arch Remove unneeded 'SUBDIRS=' from 3 Makefile.am files 2019-04-04 19:31:39 +02:00
ccmain paramsd: Replace strtod by std::stringstream 2019-05-04 14:34:58 +02:00
ccstruct fix crash in case of missing PNG support in Leptonica see #2333 2019-05-01 20:14:26 +02:00
ccutil Fix UNICHARSET::save_to_string for locale de_DE.UTF-8 2019-05-16 20:23:40 +02:00
classify Fix out-of-bounds writes in Classify::ReadNewCutoffs 2019-05-18 13:59:48 +02:00
cutil oldlist: Fix comments 2019-05-17 14:41:11 +02:00
dict MSVS support inttypes.h from VS 2015 2019-05-01 11:29:03 +02:00
lstm Add some of the lstm_choice_mode functionality to restore compatibility with the 4.0 Version 2019-04-30 15:33:52 +02:00
opencl OpenCL: Remove PERF_COUNT framework 2019-02-09 10:58:15 +01:00
textord Fix cast from pointer to integer type 2019-05-16 20:16:56 +02:00
training Fix Doxygen comments for void functions 2019-05-16 20:19:01 +02:00
viewer Fix Doxygen comment 2019-05-16 20:17:16 +02:00
vs2010/tesseract replace VS implementation of gettimeofday with std::chrono::steady_clock::now(); fixes #2038 2018-11-08 19:43:46 +01:00
wordrec unittest: Fix and enable params_model_test 2019-05-01 11:21:29 +02:00