tesseract-ocr / tesseract

Tesseract Open Source OCR Engine (main repository)
https://tesseract-ocr.github.io/
Apache License 2.0
62.05k stars 9.49k forks source link

Native Crash in otsuthr.cpp #4217

Closed Vensent closed 7 months ago

Vensent commented 7 months ago

Current Behavior

I got an error which happened frequently in Android Platform.

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'OPPO/PHA120/OP5267:12/SKQ1.211209.001/R.16ce23f-23cc6-23cc7:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2024-03-29 15:59:06.878885412+0800
Process uptime: 0s
Cmdline: com.oplus.games
pid: 8022, tid: 9112, name: pool-30-thread-  >>> com.oplus.games <<<
uid: 10257
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Cause: null pointer dereference
    x0  0000000000000000  x1  0000006f5aed84f8  x2  0000000000000026  x3  ffffffffffffffff
    x4  ffffffffffffffff  x5  0000000000000000  x6  64631f736e6d1f77  x7  7f7f7f7f7f7f7f7f
    x8  0000000000000000  x9  0000000000000000  x10 0000000000000001  x11 0000000000000000
    x12 0000000000000001  x13 0000006f5aed7b3a  x14 0000000000000010  x15 0000000000000000
    x16 0000007109f2ead8  x17 0000007109f1fee4  x18 0000006f5336e000  x19 0000006f5aed91c0
    x20 0000006f5aedb000  x21 0000006f5aed91d8  x22 0000000000000000  x23 0000000000000000
    x24 0000000000000000  x25 0000000000000000  x26 0000000000000000  x27 0000000000000000
    x28 0000006f5aed9f60  x29 0000006f5aed9160
    lr  0000006f1f4ea76c  sp  0000006f5aed8d10  pc  0000006f1f4ea9cc  pst 0000000080001000

backtrace:
      #00 pc 00000000002309cc  /data/app/~~8hClpaLzfM8gEHHVjIYrZA==/com.oplus.games-eQPYI12o16PTpIvEXRtWPA==/lib/arm64/libtesseract.so (tesseract::OtsuThreshold(tesseract::Image, int, int, int, int, std::__ndk1::vector<int, std::__ndk1::allocator<int> >&, std::__ndk1::vector<int, std::__ndk1::allocator<int> >&)+692) (BuildId: 438fb5aa6ed933fdcb877cd2bfb25216e37ed97a)
      #01 pc 0000000000213d90  /data/app/~~8hClpaLzfM8gEHHVjIYrZA==/com.oplus.games-eQPYI12o16PTpIvEXRtWPA==/lib/arm64/libtesseract.so (tesseract::ImageThresholder::GetPixRectThresholds()+124) (BuildId: 438fb5aa6ed933fdcb877cd2bfb25216e37ed97a)
      #02 pc 00000000001b2c48  /data/app/~~8hClpaLzfM8gEHHVjIYrZA==/com.oplus.games-eQPYI12o16PTpIvEXRtWPA==/lib/arm64/libtesseract.so (tesseract::TessBaseAPI::Threshold(Pix**)+508) (BuildId: 438fb5aa6ed933fdcb877cd2bfb25216e37ed97a)
      #03 pc 00000000001b6e78  /data/app/~~8hClpaLzfM8gEHHVjIYrZA==/com.oplus.games-eQPYI12o16PTpIvEXRtWPA==/lib/arm64/libtesseract.so (tesseract::TessBaseAPI::FindLines()+200) (BuildId: 438fb5aa6ed933fdcb877cd2bfb25216e37ed97a)
      #04 pc 00000000001b7374  /data/app/~~8hClpaLzfM8gEHHVjIYrZA==/com.oplus.games-eQPYI12o16PTpIvEXRtWPA==/lib/arm64/libtesseract.so (tesseract::TessBaseAPI::Recognize(tesseract::ETEXT_DESC*)+52) (BuildId: 438fb5aa6ed933fdcb877cd2bfb25216e37ed97a)
      #05 pc 00000000001b6230  /data/app/~~8hClpaLzfM8gEHHVjIYrZA==/com.oplus.games-eQPYI12o16PTpIvEXRtWPA==/lib/arm64/libtesseract.so (tesseract::TessBaseAPI::GetUTF8Text()+72) (BuildId: 438fb5aa6ed933fdcb877cd2bfb25216e37ed97a)
      #06 pc 000000000034718c  /data/app/~~8hClpaLzfM8gEHHVjIYrZA==/com.oplus.games-eQPYI12o16PTpIvEXRtWPA==/lib/arm64/libtesseract.so (Java_com_googlecode_tesseract_android_TessBaseAPI_nativeGetUTF8Text+64) (BuildId: 438fb5aa6ed933fdcb877cd2bfb25216e37ed97a)
      #07 pc 000000000025e874  /data/app/~~8hClpaLzfM8gEHHVjIYrZA==/com.oplus.games-eQPYI12o16PTpIvEXRtWPA==/oat/arm64/base.odex (art_jni_trampoline+116)

And I used symbolic tool to locate the error:

********** Crash dump: **********
Build fingerprint: 'OPPO/PHA120/OP5267:12/SKQ1.211209.001/R.16ce23f-23cc6-23cc7:user/release-keys'
#00 0x00000000002309cc /data/app/~~8hClpaLzfM8gEHHVjIYrZA==/com.oplus.games-eQPYI12o16PTpIvEXRtWPA==/lib/arm64/libtesseract.so (tesseract::OtsuThreshold(tesseract::Image, int, int, int, int, std::__ndk1::vector<int, std::__ndk1::allocator<int> >&, std::__ndk1::vector<int, std::__ndk1::allocator<int> >&)+692) (BuildId: 438fb5aa6ed933fdcb877cd2bfb25216e37ed97a)
                                                                                                                                tesseract::OtsuThreshold(tesseract::Image, int, int, int, int, std::__ndk1::vector<int, std::__ndk1::allocator<int> >&, std::__ndk1::vector<int, std::__ndk1::allocator<int> >&)
                                                                                                                                E:/work/GitLab/tesseract4android/tesseract4android\src/main/cpp/tesseract/src/src/ccstruct/otsuthr.cpp:137:30
#01 0x0000000000213d90 /data/app/~~8hClpaLzfM8gEHHVjIYrZA==/com.oplus.games-eQPYI12o16PTpIvEXRtWPA==/lib/arm64/libtesseract.so (tesseract::ImageThresholder::GetPixRectThresholds()+124) (BuildId: 438fb5aa6ed933fdcb877cd2bfb25216e37ed97a)
                                                                                                                                tesseract::ImageThresholder::GetPixRectThresholds()
                                                                                                                                E:/work/GitLab/tesseract4android/tesseract4android\src/main/cpp/tesseract/src/src/ccmain/thresholder.cpp:333:3
#02 0x00000000001b2c48 /data/app/~~8hClpaLzfM8gEHHVjIYrZA==/com.oplus.games-eQPYI12o16PTpIvEXRtWPA==/lib/arm64/libtesseract.so (tesseract::TessBaseAPI::Threshold(Pix**)+508) (BuildId: 438fb5aa6ed933fdcb877cd2bfb25216e37ed97a)
                                                                                                                                tesseract::TessBaseAPI::Threshold(Pix**)
                                                                                                                                E:/work/GitLab/tesseract4android/tesseract4android\src/main/cpp/tesseract/src/src/api/baseapi.cpp:2106:52
#03 0x00000000001b6e78 /data/app/~~8hClpaLzfM8gEHHVjIYrZA==/com.oplus.games-eQPYI12o16PTpIvEXRtWPA==/lib/arm64/libtesseract.so (tesseract::TessBaseAPI::FindLines()+200) (BuildId: 438fb5aa6ed933fdcb877cd2bfb25216e37ed97a)
                                                                                                                                tesseract::TessBaseAPI::FindLines()
                                                                                                                                E:/work/GitLab/tesseract4android/tesseract4android\src/main/cpp/tesseract/src/src/api/baseapi.cpp:2161:47
#04 0x00000000001b7374 /data/app/~~8hClpaLzfM8gEHHVjIYrZA==/com.oplus.games-eQPYI12o16PTpIvEXRtWPA==/lib/arm64/libtesseract.so (tesseract::TessBaseAPI::Recognize(tesseract::ETEXT_DESC*)+52) (BuildId: 438fb5aa6ed933fdcb877cd2bfb25216e37ed97a)
                                                                                                                                tesseract::TessBaseAPI::Recognize(tesseract::ETEXT_DESC*)
                                                                                                                                E:/work/GitLab/tesseract4android/tesseract4android\src/main/cpp/tesseract/src/src/api/baseapi.cpp:839:7
#05 0x00000000001b6230 /data/app/~~8hClpaLzfM8gEHHVjIYrZA==/com.oplus.games-eQPYI12o16PTpIvEXRtWPA==/lib/arm64/libtesseract.so (tesseract::TessBaseAPI::GetUTF8Text()+72) (BuildId: 438fb5aa6ed933fdcb877cd2bfb25216e37ed97a)
                                                                                                                                tesseract::TessBaseAPI::GetUTF8Text()
                                                                                                                                E:/work/GitLab/tesseract4android/tesseract4android\src/main/cpp/tesseract/src/src/api/baseapi.cpp:1381:55
#06 0x000000000034718c /data/app/~~8hClpaLzfM8gEHHVjIYrZA==/com.oplus.games-eQPYI12o16PTpIvEXRtWPA==/lib/arm64/libtesseract.so (Java_com_googlecode_tesseract_android_TessBaseAPI_nativeGetUTF8Text+64) (BuildId: 438fb5aa6ed933fdcb877cd2bfb25216e37ed97a)
                                                                                                                                Java_com_googlecode_tesseract_android_TessBaseAPI_nativeGetUTF8Text
                                                                                                                                E:/work/GitLab/tesseract4android/tesseract4android\src/main/cpp/tesseract/tessbaseapi.cpp:344:25
#07 0x000000000025e874 /data/app/~~8hClpaLzfM8gEHHVjIYrZA==/com.oplus.games-eQPYI12o16PTpIvEXRtWPA==/oat/arm64/base.odex (art_jni_trampoline+116)

Expected Behavior

No response

Suggested Fix

No response

tesseract -v

4.7.0

Operating System

No response

Other Operating System

Android

uname -a

No response

Compiler

CMAKE with Android NDK.

CPU

arm64-v8a

Virtualization / Containers

No response

Other Information

No response

amitdo commented 7 months ago

tesseract -v

4.7.0

We never released such a version.

Does this issue happen on any image with a recent version of Tesseract itself, the command line tool that we released (compared to a 3rd party tool that adds its own stuff on top of our code) ?

https://tesseract-ocr.github.io/tessdoc/ReleaseNotes.html

amitdo commented 7 months ago

You also need to provide an image that we can use to trigger the issue, but again, you should first try Tesseract itself.