Skip to content
This repository has been archived by the owner on Dec 9, 2018. It is now read-only.

Program received signal SIGSEGV, Segmentation fault. #722

Open
aybb opened this issue May 29, 2017 · 5 comments
Open

Program received signal SIGSEGV, Segmentation fault. #722

aybb opened this issue May 29, 2017 · 5 comments

Comments

@aybb
Copy link

aybb commented May 29, 2017

Hi, I faced problem with converting on ubuntu 16.04.

pdf2htmlEX version 0.14.6
Copyright 2012-2015 Lu Wang <[email protected]> and other contributors
Libraries:
  poppler 0.43.0
  libfontforge 20170529
  cairo 1.14.6
Default data-dir: /usr/local/share/pdf2htmlEX
Supported image format: png svg

I tried to use debugger, but can't figure out where's the problem.

EncMapFromEncoding (sf=0x1fb02b0, enc=0xfffffffff7323200) at encoding.c:1861
1861	encoding.c: No such file or directory.
(gdb) backtrace
#0  EncMapFromEncoding (sf=0x1fb02b0, enc=0xfffffffff7323200) at encoding.c:1861
#1  0x000000000044ce00 in ffw_do_reencode ()
#2  0x0000000000440fd4 in pdf2htmlEX::HTMLRenderer::embed_font(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, GfxFont*, pdf2htmlEX::FontInfo&, bool) ()
#3  0x0000000000441917 in pdf2htmlEX::HTMLRenderer::install_external_font(GfxFont*, pdf2htmlEX::FontInfo&) ()
#4  0x0000000000441eff in pdf2htmlEX::HTMLRenderer::install_font(GfxFont*) ()
#5  0x00000000004458b5 in pdf2htmlEX::HTMLRenderer::check_state_change(GfxState*) ()
#6  0x00000000004467bc in pdf2htmlEX::HTMLRenderer::drawString(GfxState*, GooString*) ()
#7  0x00007ffff7a60fa6 in Gfx::doShowText (this=this@entry=0x732b70, s=0x733380) at Gfx.cc:4118
#8  0x00007ffff7a616ad in Gfx::opShowSpaceText (this=0x732b70, args=0x7fffffffdec0, numArgs=<optimized out>) at Gfx.cc:3913
#9  0x00007ffff7a5918e in Gfx::go (this=this@entry=0x732b70, topLevel=topLevel@entry=true) at Gfx.cc:763
#10 0x00007ffff7a59630 in Gfx::display (this=this@entry=0x732b70, obj=obj@entry=0x7fffffffe1c0, topLevel=topLevel@entry=true) at Gfx.cc:729
#11 0x00007ffff7a9bce5 in Page::displaySlice (this=0x7223e0, out=0x6c1c10, hDPI=72, vDPI=72, rotate=0, useMediaBox=false, crop=<optimized out>,
    sliceX=sliceX@entry=-1, sliceY=-1, sliceW=-1, sliceH=-1, printing=false, abortCheckCbk=0x0, abortCheckCbkData=0x0, annotDisplayDecideCbk=0x0,
    annotDisplayDecideCbkData=0x0, copyXRef=false) at Page.cc:599
#12 0x00007ffff7a9bf48 in Page::display (this=<optimized out>, out=<optimized out>, hDPI=<optimized out>, vDPI=<optimized out>, rotate=<optimized out>,
    useMediaBox=<optimized out>, crop=<optimized out>, printing=<optimized out>, abortCheckCbk=0x0, abortCheckCbkData=0x0, annotDisplayDecideCbk=0x0,
    annotDisplayDecideCbkData=0x0, copyXRef=false) at Page.cc:521
#13 0x00000000004398cd in pdf2htmlEX::HTMLRenderer::process(PDFDoc*) ()
#14 0x000000000042056f in main ()
@billeranton
Copy link

Have the same problem and tracked it down to the encoding pointers in ffw.c:

static Encoding * original_enc = NULL;
static Encoding * unicodefull_enc = NULL;
static Encoding * enc_head = NULL;

These are set in the function void ffw_init(int debug) but the returned addresses from fontforge do not match, e.g:

FUNC _FindOrMakeEncoding: return enc address from enclist: 0x7f2f07cf0320
FUNC ffw_init: original_enc address: 0x7cf0320

The returned address in this example only contains the last 4bytes and the preceding part 7f2f0 is omitted. I generated the output via:
printf("ffw_init original_enc address: %p\n", original_enc);
and
printf("_FindOrMakeEncoding enc address from enclist: %p\n", enc);

I hope the printf code is correct and does not provide false information. Can't fathom why the addresses do not match.

@dalcde
Copy link

dalcde commented Sep 26, 2017

I have two machines, both running Arch linux

  • On the first machine, the problem as described by @billeranton occurs
  • On my second machine, the problem does not occur if I compile master with poppler 0.57, but does occur when I compile Issue 733 poppler 0.59.0 #735 with poppler 0.59.
    UPDATE: I tried to recompile master under 0.57, and the problem apparently occurs again

@akhuettel
Copy link

akhuettel@46160f0

@Watersoul
Copy link

I tried to compile @akhuettel fork, but got errors (

# cmake .
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for module 'poppler>=0.25.0'
--   Found poppler, version 0.62.0
-- Checking for module 'cairo>=1.10.0'
--   Found cairo, version 1.14.6
Trying to locate cairo-svg...
-- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so
-- Checking for module 'libfontforge>=2.0.0'
--   Found libfontforge, version 2.0.20161004
-- Performing Test CXX0X_SUPPORT
-- Performing Test CXX0X_SUPPORT - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/src/web/git/1/pdf2htmlEX

# make
Scanning dependencies of target pdf2htmlEX
[  2%] Building CXX object CMakeFiles/pdf2htmlEX.dir/3rdparty/poppler/git/CairoFontEngine.cc.o
/usr/src/web/git/1/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc: In function ‘cairo_status_t _render_type3_glyph(cairo_scaled_font_t*, long unsigned int, cairo_t*, cairo_text_extents_t*)’:
/usr/src/web/git/1/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc:710:37: error: no matching function for call to ‘Dict::getVal(long unsigned int&)’
   charProc = charProcs->getVal(glyph);
                                     ^
In file included from /usr/local/include/poppler/Object.h:321:0,
                 from /usr/local/include/poppler/GfxFont.h:41,
                 from /usr/src/web/git/1/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.h:40,
                 from /usr/src/web/git/1/pdf2htmlEX/3rdparty/poppler/git/CairoFontEngine.cc:40:
/usr/local/include/poppler/Dict.h:85:11: note: candidate: Object* Dict::getVal(int, Object*)
   Object *getVal(int i, Object *obj);
           ^
/usr/local/include/poppler/Dict.h:85:11: note:   candidate expects 2 arguments, 1 provided
CMakeFiles/pdf2htmlEX.dir/build.make:62: recipe for target 'CMakeFiles/pdf2htmlEX.dir/3rdparty/poppler/git/CairoFontEngine.cc.o' failed
make[2]: *** [CMakeFiles/pdf2htmlEX.dir/3rdparty/poppler/git/CairoFontEngine.cc.o] Error 1
CMakeFiles/Makefile2:355: recipe for target 'CMakeFiles/pdf2htmlEX.dir/all' failed
make[1]: *** [CMakeFiles/pdf2htmlEX.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

@Watersoul
Copy link

Ah, sry. It seems to my fault.
Forgot compile poppler with xpdf headers (
TY

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants