Commit Graph

5220 Commits

Author SHA1 Message Date
Stefan Weil
d33edbc4b1
Merge pull request #3066 from robinwatts/pushback14
Remove unused char constant that causes a warning.
2020-07-17 15:55:51 +02:00
Robin Watts
578462109b Remove unused char constant that causes a warning.
The kDictWildcard is never actually used, so removing it makes
no difference. It causes warnings in MSVC builds as MSVC doesn't
know how to pack a unicode value into chars.
2020-07-17 14:22:37 +01:00
zdenop
749851d39d
Merge pull request #3065 from robinwatts/pushback13
Squash some warnings in MSVC build.
2020-07-16 14:41:43 +02:00
Robin Watts
150e2e54fe Squash some warnings in MSVC build.
In particular, "defined but not used" (caused by GRAPHICS_DISABLED),
double constants being truncated to floats, and implicit casts.
2020-07-16 10:08:40 +01:00
zdenop
7fa200bfb7
Merge pull request #3064 from robinwatts/pushback12
Fix Memory leak when using TESSERACT_IMAGEDATA_AS_PIX
2020-07-15 19:08:58 +02:00
Robin Watts
7f45b719d1 Fix Memory leak when using TESSERACT_IMAGEDATA_AS_PIX
If building with TESSERACT_IMAGEDATA_AS_PIX, then tesseract
doesn't compress/decompress images, but rather holds the
data as internal Pix structures. Unfortunately, I forgot to
make the ImageData destructor free these, so memory leaked
during use. Fixed here.
2020-07-15 12:35:35 +01:00
zdenop
135c8a49b5
Merge pull request #3061 from stweil/neon
Always use NEON by default for ARMv8
2020-07-11 09:11:54 +02:00
zdenop
875bd48bd5
Merge pull request #3058 from stweil/scrollview
Disable more code and data with GRAPHICS_DISABLED
2020-07-11 09:11:27 +02:00
Stefan Weil
548a832b98 Use strtok_s for MSVC in class SVNetwork
strtok_s can be used with MSVC as a replacement for strtok_r, so less
special handling is needed in the code and class SVNetwork can be
made smaller by removing member has_content.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-07-10 17:47:05 +02:00
Stefan Weil
636c37fa01
Merge pull request #3060 from edwinnyawoli/patch-1 2020-07-10 16:06:25 +02:00
Edwin Nyawoli
317495ecb8
Link 'traineddata' word to its documentation
This is to help make it clearer to users
2020-07-10 14:01:37 +00:00
Stefan Weil
2db2223b39 Always use NEON by default for ARMv8
Signed-off-by: Stefan Weil <stefan.weil@bib.uni-mannheim.de>
2020-07-10 15:27:09 +02:00
Edwin Nyawoli
1fb6c41e0f
Fix typo in README.md 2020-07-10 12:06:48 +00:00
Stefan Weil
cb3880fb15 Disable more code and data with GRAPHICS_DISABLED
Some runtime parameters which are only relevant with graphics enabled
were now removed from builds when graphics was disabled.

TableFinder::DisplayColSegmentGrid is never used, so remove it completely.

Builds with --disable-graphics significantly reduce the code size and avoid
some function calls which might be important for certain applications:

   text	   data	    bss	    dec	    hex	filename
3219230	  41136	  13920	3274286	 31f62e	.libs/libtesseract.so (--disable-graphics, old)
3211347	  40976	  13600	3265923	 31d583	.libs/libtesseract.so (--disable-graphics, new)
3360942	  43656	  15392	3419990	 342f56	.libs/libtesseract.so (default)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-07-09 11:23:33 +02:00
Stefan Weil
22e6c2e5a7 Fix division by 0.0 in BaselineRow::PerpDistanceFromBaseline
It was reported by oss-fuzz (issue 23962).

Add log output to find real images which trigger that issue.
Avoid also some conversions from float to double by always using float.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-07-08 17:59:02 +02:00
zdenop
b67736cd6b
Merge pull request #3055 from stweil/string
Use const char* for filename parameters
2020-07-07 18:15:04 +02:00
Stefan Weil
8137cf35a6 Use const char* for filename parameters
This replaces the proprietary STRING data type
(801 instead of 838 lines remaining).

It also removes STRING from osdetect.h and serialis.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-07-07 14:20:09 +02:00
Stefan Weil
d01b2e43b8 unittest: Update comments in normstrngs_test.cc
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-07-07 11:29:48 +02:00
zdenop
36985fcc03
Merge pull request #3052 from stweil/msvc
Fix cmake build for MSVC
2020-07-03 21:09:52 +02:00
Stefan Weil
0e79daed42 Fix cmake build for MSVC
MSVC does not support /arch:FMA or /arch:SSE4.1.
For /arch:AVX and /arch:AVX2 no check is needed because they are supported since a long time.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-07-01 21:54:51 +02:00
Stefan Weil
e910b3c20b
Merge pull request #3050 from zdenop/cmake_AVX
Update cmake builds to set right flags for AVX, ...
2020-07-01 08:52:20 +02:00
zdenop
511189b069
Update CMakeLists.txt
thanks.

Co-authored-by: Stefan Weil <sw@weilnetz.de>
2020-07-01 08:43:55 +02:00
zdenop
2538989ef5 cmake: NEON build is not supported on Mac OS X 2020-07-01 00:12:10 +02:00
zdenop
3c3e7b913f cmake: check compiler flags for AVX,AVX2,FMA,SSE4.1 support 2020-06-30 23:09:36 +02:00
zdenop
33f1e1371b cmake: eliminate OptimizeForArchitecture 2020-06-30 22:35:05 +02:00
zdenop
e6cab99040 Merge branch 'master' of https://github.com/tesseract-ocr/tesseract 2020-06-30 20:58:19 +02:00
zdenop
7e8ddfcb63 cmake: add NEON compile support 2020-06-30 20:57:50 +02:00
Stefan Weil
51dff483e7 Fix runtime error caused by too large TBOX
Runtime error reported by sanitizer:

    src/ccstruct/rect.h:191:44: runtime error: 50961 is outside the range of representable values of type 'short'
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/ccstruct/rect.h:191:44 in

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-30 20:51:52 +02:00
zdenop
30fcec3081 cmake: remove custom CheckCCompilerFlag/CheckCXXCompilerFlag 2020-06-30 20:47:31 +02:00
zdenop
8778e84eba cmake: fix policy setting for newer cmake (CheckIPOSupported) 2020-06-30 13:31:49 +02:00
Stefan Weil
2269a500ef Fix runtime error with null pointer argument
Runtime error reported by sanitizer:

    src/ccstruct/coutln.cpp:1018:19: runtime error: null pointer passed as argument 2, which is declared to never be null
    /usr/include/string.h:48:14: note: nonnull attribute specified here
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/ccstruct/coutln.cpp:1018:19 in

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-29 19:13:39 +02:00
Stefan Weil
411ffa90c6 Fix unsigned integer overflow
Runtime errors reported by sanitizer:

    src/textord/pithsync.cpp:75:31: runtime error: unsigned integer overflow: 2147483648 + 2147483648 cannot be represented in type 'unsigned int'
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/textord/pithsync.cpp:75:31 in
    src/textord/pithsync.cpp:75:43: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int'
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/textord/pithsync.cpp:75:43 in
    src/textord/pithsync.cpp:125:29: runtime error: unsigned integer overflow: 2147483648 + 2147483648 cannot be represented in type 'unsigned int'
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/textord/pithsync.cpp:125:29 in
    src/textord/pithsync.cpp:125:41: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int'
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/textord/pithsync.cpp:125:41 in

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-29 19:13:39 +02:00
Stefan Weil
7c77b40e8c unittest: Remove unused local variables
This fixes two compiler warnings:

    unittest/recodebeam_test.cc:318:11: warning: unused variable 'min_t' [-Wunused-variable]
    unittest/resultiterator_test.cc:478:36: warning: unused variable 'dZ' [-Wunused-const-variable]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-29 16:19:23 +02:00
Stefan Weil
7c046c121f Fix out of bounds array access
Runtime error with enabled sanitizer:

    src/textord/colpartition.cpp:2243:66: runtime error: index -1 out of bounds for type 'tesseract::ColPartition *[6]'
    SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/textord/colpartition.cpp:2243:66 in

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-29 16:10:37 +02:00
Amit D
76b7516f98
Update README.md 2020-06-28 04:44:07 +03:00
Amit D
15f0a19170
README.md: Show only open issues of oss-fuzz 2020-06-28 04:27:34 +03:00
zdenop
744697e502 Merge branch 'master' of https://github.com/tesseract-ocr/tesseract 2020-06-26 15:42:32 +02:00
zdenop
6c2d3f52f3 cmake: allow to enable LTO 2020-06-26 15:38:00 +02:00
zdenop
d17ec2c754
Merge pull request #3036 from xuzhen/master
Fixed CMakeLists.txt for the compilers without C++17 support
2020-06-26 14:40:38 +02:00
zdenop
4ef709554b
Update imagedata.cpp
stop PreScale if pixScale failed (fixes #3025)
2020-06-25 20:32:51 +02:00
zdenop
ffc2f67a6b
Merge pull request #3041 from prabindh/master
Add MT option for MSVC compilation
2020-06-25 19:52:11 +02:00
Prabindh Sundareson
31edf8bdf9 Add MT option for MSVC compilation 2020-06-25 17:47:22 +05:30
zdenop
6a96e409a2
Merge pull request #3040 from amitdo/applybox3
Disabled legacy build: Disable more unused code
2020-06-25 08:22:15 +02:00
amitdo
efae270dea Disabled legacy build: Disable more unused code 2020-06-24 22:02:52 +03:00
Stefan Weil
ca0a6c9d37
Merge pull request #3035 from stweil/overflow
Avoid buffer overflow (issue #444)
2020-06-24 18:46:47 +02:00
Stefan Weil
2cb5bc7690 Improve debug message in ColPartition::ComputeLimits
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-23 22:52:45 +02:00
Xu Zhen
57fe147115
Fixed CMake with MinGW 4.9 2020-06-23 12:23:41 +08:00
Stefan Weil
cfabdfe0af Avoid buffer overflow (issue #444)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-22 22:19:58 +02:00
Egor Pugin
a164ff3728
Merge pull request #3034 from stweil/callcpp
ScrollView: Remove C API callcpp.{cpp,h}
2020-06-22 16:47:48 +03:00
Stefan Weil
62b085cb8d ScrollView: Remove C API callcpp.{cpp,h}
Use C++ class ScrollView directly instead of using an intermediate C API.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-22 09:14:26 +02:00