coredump inside tesseract 3

16 views
Skip to first unread message

Carlos Fernandez Sanz

unread,
Feb 23, 2018, 6:34:31 PM2/23/18
to tesseract-ocr
Hi,

I'm having a strange crash - not sure if it's a problem with my code (well, not "my", but I'm trying to fix the issue) or tesseract. The stack trace looks like this:

#3  0x00007fdf1b7d4e0a in malloc_printerr (ar_ptr=<optimised out>, ptr=<optimised out>,
    str=0x7fdf1b8e20b2 "free(): invalid pointer", action=3) at malloc.c:5004
#4  _int_free (av=<optimised out>, p=<optimised out>, have_lock=0) at malloc.c:3865
#5  0x00007fdf1b7d898c in __GI___libc_free (mem=<optimised out>) at malloc.c:2966
#6  0x00007fdf1c14072b in TWERD::Clear() () from /usr/lib/libtesseract.so.3
#7  0x00007fdf1c15ae22 in WERD_RES::ClearResults() () from /usr/lib/libtesseract.so.3
#8  0x00007fdf1c15c4e9 in WERD_RES::~WERD_RES() () from /usr/lib/libtesseract.so.3
#9  0x00007fdf1c15c57e in WERD_RES_zapper(ELIST_LINK*) () from /usr/lib/libtesseract.so.3
#10 0x00007fdf1c17e5f5 in ELIST::internal_clear(void (*)(ELIST_LINK*)) () from /usr/lib/libtesseract.so.3
#11 0x00007fdf1c155569 in ROW_RES_zapper(ELIST_LINK*) () from /usr/lib/libtesseract.so.3
#12 0x00007fdf1c17e5f5 in ELIST::internal_clear(void (*)(ELIST_LINK*)) () from /usr/lib/libtesseract.so.3
#13 0x00007fdf1c155b19 in BLOCK_RES_c1_zapper(void*) () from /usr/lib/libtesseract.so.3
#14 0x00007fdf1c17e5f5 in ELIST::internal_clear(void (*)(ELIST_LINK*)) () from /usr/lib/libtesseract.so.3
#15 0x00007fdf1bfe7392 in tesseract::TessBaseAPI::ClearResults() () from /usr/lib/libtesseract.so.3
#16 0x00007fdf1bfe749f in tesseract::TessBaseAPI::InternalSetImage() () from /usr/lib/libtesseract.so.3
#17 0x00007fdf1bfe7581 in tesseract::TessBaseAPI::SetImage(Pix*) () from /usr/lib/libtesseract.so.3
#18 0x00000000004157e7 in ocr_bitmap (arg=0x170d3d0, palette=0x25dad40, alpha=0x2828a80 "", indata=0xb0eddb0 "", w=720,
    h=36, copy=0x2a4f830) at ../src/lib_ccx/ocr.c:260
#19 0x000000000041797e in ocr_rect (arg=0x170d3d0, rect=0x29b9370, str=0x7ffc31572678, bgcolor=0, ocr_quantmode=0)
    at ../src/lib_ccx/ocr.c:807

The code at ../src/lib_ccx/ocr.c:225-260 is

        cpix = pixConvertRGBToGray(cpix, 0.0, 0.0, 0.0); // Abhinav95: Converting image to grayscale for OCR to avoid issues with transparency
        TessBaseAPISetImage2(ctx->api, cpix);

where ctx->api is obviously the tesseract handle and cpix is PIX *.
I don't know tesseract's internals, but what could be that free() call that fails?

The complete source code is here, in case someone has time to take a look at our whole thing: 

Thanks

Carlos






Reply all
Reply to author
Forward
0 new messages