flexpaper / pdf2json

PDF2JSON is a conversion library based on XPDF (3.02) which can be used for high performance PDF page by page conversion to JSON and XML format. It also supports compressing data to minimize size. PDF2JSON is available for Windows, OSX and Linux. Please see https://flowpaper.com for more information
305 stars 52 forks source link

Segmentation fault issue #23

Open idubinets opened 5 years ago

idubinets commented 5 years ago

When I try to convert PDF using pdf2json inside the docker container (ubuntu:xenial), I am getting the following segmentation fault issue. This is the stack trace

Starting program: /tmp/pdf2json-0.70/src/pdf2json /data/materials_cache/ObsKPcCX1X3X2X53PlwIgjVz-d592b20cba4ac78a319491def9366467/main.pdf -enc UTF-8 -compress /data/materials_cache/ObsKPcCX1X3X2X53PlwIgjVz-d592b20cba4ac78a319491def9366467/main.js

Program received signal SIGSEGV, Segmentation fault.
0x0000000000435105 in DecryptStream::getChar (this=0x6f57f0) at Decrypt.cc:271
271           c = state.aes.buf[state.aes.bufIdx++];
(gdb) bt
#0  0x0000000000435105 in DecryptStream::getChar (this=0x6f57f0) at Decrypt.cc:271
#1  0x00000000004603ee in Parser::getObj (this=this@entry=0x6efd30, obj=obj@entry=0x7fffffffe160, 
    fileKey=fileKey@entry=0x6f024c "\004\227\243\226\035ܗ\337\274>M\371\364~Vs\020", encAlgorithm=encAlgorithm@entry=cryptAES, 
    keyLength=keyLength@entry=16, objNum=objNum@entry=1338, objGen=0) at Parser.cc:127
#2  0x0000000000460677 in Parser::getObj (this=this@entry=0x6efd30, obj=obj@entry=0x7fffffffe1f0, 
    fileKey=fileKey@entry=0x6f024c "\004\227\243\226\035ܗ\337\274>M\371\364~Vs\020", encAlgorithm=encAlgorithm@entry=cryptAES, 
    keyLength=keyLength@entry=16, objNum=objNum@entry=1338, objGen=0) at Parser.cc:85
#3  0x0000000000460677 in Parser::getObj (this=this@entry=0x6efd30, obj=obj@entry=0x7fffffffe280, 
    fileKey=fileKey@entry=0x6f024c "\004\227\243\226\035ܗ\337\274>M\371\364~Vs\020", encAlgorithm=encAlgorithm@entry=cryptAES, 
    keyLength=keyLength@entry=16, objNum=objNum@entry=1338, objGen=0) at Parser.cc:85
#4  0x0000000000460677 in Parser::getObj (this=this@entry=0x6efd30, obj=obj@entry=0x7fffffffe370, 
    fileKey=0x6f024c "\004\227\243\226\035ܗ\337\274>M\371\364~Vs\020", encAlgorithm=cryptAES, keyLength=16, objNum=objNum@entry=1338, objGen=0)
    at Parser.cc:85
#5  0x000000000042b52d in XRef::fetch (this=0x6f01e0, num=1338, gen=<optimized out>, obj=obj@entry=0x7fffffffe370) at XRef.cc:824
#6  0x0000000000407fe0 in XRef::getCatalog (obj=0x7fffffffe370, this=<optimized out>) at XRef.h:72
#7  Catalog::Catalog (this=0x6eff50, xrefA=<optimized out>) at Catalog.cc:44
#8  0x000000000041edb1 in PDFDoc::setup (this=this@entry=0x6f0190, ownerPassword=ownerPassword@entry=0x0, userPassword=userPassword@entry=0x0)
    at PDFDoc.cc:201
#9  0x000000000041ef2c in PDFDoc::PDFDoc (this=0x6f0190, fileNameA=<optimized out>, ownerPassword=0x0, userPassword=0x0, guiDataA=<optimized out>)
    at PDFDoc.cc:101
#10 0x00000000004020a4 in main (argc=3, argv=0x7fffffffe658) at pdf2json.cc:159