Commit Graph

5090 Commits

Author SHA1 Message Date
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
zdenop
defc44e3a2
Merge pull request #3033 from stweil/cprintf
Replace cprintf by tprintf and remove cprintf and fix insecure call of tprintf
2020-06-22 09:02:14 +02:00
Stefan Weil
b2cc00d97f Replace cprintf by tprintf and remove cprintf
cprintf was an indirect way to call tprintf.
This indirection is not needed, so remove it and use tprintf directly.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-21 19:07:09 +02:00
Stefan Weil
ea1f597fc1 Fix insecure call of tprintf
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-21 19:03:03 +02:00
Stefan Weil
bf39019d95 Remove obsolescent macro AC_HEADER_STDC
See
https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Particular-Headers.html.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-21 18:50:06 +02:00
Stefan Weil
27b254476f Remove obsolescent macro AC_HEADER_TIME
See
https://www.gnu.org/software/autoconf/manual/autoconf-2.67/html_node/Particular-Headers.html.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-21 18:48:20 +02:00
Stefan Weil
0a63484644 Remove checks for unused types off_t, mbstate_t, _Bool
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-21 12:04:16 +02:00
Stefan Weil
4a10bb68c7 Fix conversion of images with 16 bpp or 24 bpp to grey
The old code used pixConvertRGBToLuminance which only converts 32 bpp images.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-21 09:09:49 +02:00
Stefan Weil
6f6100ff9f Classify: Run sort only for more than one element
This fixes calls of qsort with a nullptr argument (reported by sanitizers).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-20 21:43:22 +02:00
zdenop
5a698c278d
Merge pull request #3031 from stweil/clean
thanks
2020-06-20 11:48:49 +02:00
Stefan Weil
958b90d785 Don't check for unused sys/wait.h
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-20 11:01:20 +02:00
Stefan Weil
a1aea84a27 Don't check for unused sys/shm.h and sys/ipc.h
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-20 10:59:54 +02:00
Stefan Weil
fd30c86674 Remove endianness test (WORDS_BIGENDIAN is unused)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-20 10:47:00 +02:00
Stefan Weil
c1494fb710 Don't check for stdbool.h (only used in capi.h)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-20 10:42:28 +02:00
Stefan Weil
d4cf77c92b Don't check for limits.h (now unused)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-20 10:39:13 +02:00
zdenop
d6a5fb2db5
Merge pull request #3027 from amitdo/master
Disabled legacy build: Don't compile permdawg.cpp
2020-06-19 08:18:58 +02:00
Stefan Weil
a1d161326e Don't check for unused malloc.h
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-19 07:30:00 +02:00
amitdo
eb5ad74665 Disabled legacy build: Don't compile permdawg.cpp 2020-06-18 18:24:17 +03:00
Matej Knopp
e900252c1a Fix CMake build with DISABLED_LEGACY_ENGINE 2020-06-17 19:42:49 +02:00
Stefan Weil
d6ca7a5298 ScrollView: Fix typo in comment
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-17 16:26:41 +02:00
Stefan Weil
380466e0d3 Allow inlining of function TruncateParam
It is only used locally in intproto.cpp, so defining it before the first
use and adding the static attribute allows the compiler to inline it.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-16 20:17:41 +02:00
Stefan Weil
93cfffeb87 Remove unused argument from function TruncateParam
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-16 20:17:41 +02:00
Stefan Weil
f08b16a5a0 Remove assertion which is triggered by tests
oss-fuzz issue 15149 triggers this assertion. See test case here:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=15149

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-16 20:17:26 +02:00
Stefan Weil
18d9983f69 StrokeWidth: Remove unused local variable (fixes compiler warning)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-16 20:17:09 +02:00
zdenop
7f14f11f80
Merge pull request #3023 from stweil/inline 2020-06-16 20:03:42 +02:00
Stefan Weil
bc61038dd4 SPLIT: Make function bounding_box inline for better performance
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-16 17:21:36 +02:00
Stefan Weil
0e7701bc3c SEAM: More inline functions for better performance
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-16 17:20:14 +02:00
Stefan Weil
e45100ebf7 TBOX: Use inline constructor for better performance
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-16 17:17:55 +02:00
zdenop
58c60e6c98
Merge pull request #3022 from stweil/fix
Fix undefined shift with negative value (oss-fuzz issue 14658)
2020-06-16 13:48:22 +02:00
Stefan Weil
c110958ffa Fix undefined shift with negative value (oss-fuzz issue 14658)
This fixes a bug reported by OSS Fuzz:
https://oss-fuzz.com/issue/5697280134348800

The old code passed a negative value (-1) as argument to step_dir
when destindex was 0.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-16 13:25:32 +02:00
Stefan Weil
6ee3698958 Remove old unused code from imagedata.h
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2020-06-14 16:02:27 +02:00