-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected C++ exception in tesseract::addAvailableLanguages #4364
Comments
There is also an exception if |
@jobermayr, do you really get a crash? Or is it a C++ exception (which is not a crash)? |
@stweil: I get a crash on Windows (built with VS2017) |
Why should I touch not installed file/dir?
There are also Rather, libtesseract has to react correctly and not leading to the crash if they aren't installed (correct error handling!). |
So this is a C++ exception, not a crash. I'll update the issue title. |
There are two different issues with similar results:
The touch command is one way to test the 2nd case. |
Current Behavior
$ LANG=en ls /usr/share/tessdata
ls: cannot access '/usr/share/tessdata': No such file or directory
#8 0x00007ffff7aad57b in std::filesystem::__cxx11::recursive_directory_iterator::recursive_directory_iterator
(this=0x7fffffffc2b0, __p=filesystem::path "/usr/share/tessdata/" = {...}, __options=(std::filesystem::directory_options::follow_directory_symlink | std::filesystem::directory_options::skip_permission_denied))
at /usr/include/c++/14/bits/fs_dir.h:514
#9 tesseract::addAvailableLanguages (datadir="/usr/share/tessdata/", langs=langs@entry=0x7fffffffc620) at src/api/baseapi.cpp:152
#10 0x00007ffff7aae2d0 in tesseract::TessBaseAPI::GetAvailableLanguagesAsVector (this=this@entry=0x7fffdc0021d8, langs=langs@entry=0x7fffffffc620) at src/api/baseapi.cpp:399
Expected Behavior
It doesn't crash.
Suggested Fix
https://github.com/tesseract-ocr/tesseract/blob/main/src/api/baseapi.cpp#L149:
Add check here whether path/file exists and return if not.
tesseract -v
No response
Operating System
No response
Other Operating System
No response
uname -a
No response
Compiler
No response
CPU
No response
Virtualization / Containers
No response
Other Information
No response
The text was updated successfully, but these errors were encountered: