ccouzens / tesseract-sys

Rust FFI bindings to tesseract
MIT License
26 stars 18 forks source link

tesseract call abort fn #24

Open ava57r opened 1 year ago

ava57r commented 1 year ago

Hello tesseract cpp can call abort fn https://github.com/tesseract-ocr/tesseract/blob/main/src/ccutil/errcode.cpp#L83

rust can not catch this call Could We make this call more safer? https://github.com/rust-lang/rust/issues/74990

ccouzens commented 1 year ago

Hey

Sorry I'm only now getting round to looking at this.

I don't think there's much we can do directly. I think the mentions of abort in the rust tracker issue are different to the abort in errcode.cpp. the former is the general idea of the program quitting in regards to panics. The latter is the libc function.

What we could do is:

  1. Sandbox the library using wasm. There are likely to be performance issues with that as tesseract presumably uses SIMD and threading.
  2. Ask tesseract upstream to remove this call to abort. Do you have a test case that triggers this abort?
ava57r commented 12 months ago

I did not catch a test case.

ava57r commented 10 months ago

2023-12-14-15-48-Jpeg-59

I caught this on production but I can not reproduce in test case

ava57r commented 9 months ago

I updated on v5.3.4

I found this

!w_it.cycled_list():Error:Assert failed:in file /tmp/tesseract-5.3.4/src/ccstruct/pageres.cpp, line 1502

https://github.com/tesseract-ocr/tesseract/blob/main/src/ccstruct/pageres.cpp#L1502