Skip to content
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

(signal: 11, SIGSEGV: invalid memory reference) #34

Open
olalonde opened this issue Feb 17, 2023 · 6 comments
Open

(signal: 11, SIGSEGV: invalid memory reference) #34

olalonde opened this issue Feb 17, 2023 · 6 comments

Comments

@olalonde
Copy link

Fails with (signal: 11, SIGSEGV: invalid memory reference) when both Options are None on ::new().

    let mut tesseract = Tesseract::new(None, None)?
ccouzens added a commit that referenced this issue Feb 26, 2023
@ccouzens
Copy link
Collaborator

Hey, I tried this out in a test

b6b11b1

and it works fine for me.

Can you tell me more about your setup?

@olalonde
Copy link
Author

olalonde commented Feb 26, 2023

I'm on MacOs M1, installed tesseract with brew install tesseract. I wasn't able to run the test unfortunately.

~/code/tesseract-rs$ tesseract --version                                                                                                               b6b11b1
tesseract 5.3.0
 leptonica-1.82.0
  libgif 5.2.1 : libjpeg 8d (libjpeg-turbo 2.1.3) : libpng 1.6.39 : libtiff 4.4.0 : zlib 1.2.11 : libwebp 1.3.0 : libopenjp2 2.5.0
 Found NEON
 Found libcurl/7.79.1 SecureTransport (LibreSSL/3.3.5) zlib/1.2.11 nghttp2/1.45.1

~/code/tesseract-rs0 cargo test                                                                                                                        b6b11b1
   Compiling leptonica-plumbing v1.0.0
error[E0277]: `?` couldn't convert the error to `PixReadMemError`
  --> /Users/redacted/.cargo/registry/src/github.com-1ecc6299db9ec823/leptonica-plumbing-1.0.0/src/pix.rs:68:73
   |
68 |         let ptr = unsafe { pixReadMem(img.as_ptr(), img.len().try_into()?) };
   |                                                                         ^ the trait `From<Infallible>` is not implemented for `PixReadMemError`
   |
   = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
   = help: the trait `From<TryFromIntError>` is implemented for `PixReadMemError`
   = note: required for `Result<RefCountedExclusive<pix::Pix>, PixReadMemError>` to implement `FromResidual<Result<Infallible, Infallible>>`

For more information about this error, try `rustc --explain E0277`.
error: could not compile `leptonica-plumbing` due to previous error

@ccouzens
Copy link
Collaborator

I also started seeing this 2nd error occasionally. That particular one should be fixed now.

ccouzens/leptonica-plumbing#7

@olalonde
Copy link
Author

Strangely, the test passes on my machine as well. Maybe it's some kind of heisenbug or a bug in the tesseract library itself. I'll let you know if I find a way to reproduce it.

@olalonde
Copy link
Author

I found out that it fails at the recognize() step.

    let mut tesseract = Tesseract::new(None, None)?
        .set_image_from_mem(&png_bytes)?;
    tesseract = tesseract
        .recognize()?;

@ccouzens
Copy link
Collaborator

I've reproduced the issue.

s3bk pushed a commit to s3bk/tesseract-rs that referenced this issue Feb 27, 2023
ccouzens added a commit to ccouzens/tesseract-plumbing that referenced this issue Nov 21, 2023
antimatter15/tesseract-rs#34

We should be blocking users from segmentation faults and similar. While
the bug is there, we should block it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants