wanglongqi / pdf2djvu

Automatically exported from code.google.com/p/pdf2djvu
0 stars 2 forks source link

segmentation fault in tcd_decode_tile #87

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Download the first volume of OED from 
https://archive.org/download/oed01arch/oed01arch.pdf
2. Call pdf2djvu on the file using only -o option.

What is the expected output? What do you see instead?

There is a lot of "Bogus memory allocation size" messages and, during 
processing of page #212, "Segmentation fault".

What version of the product are you using? On what operating system?

pdf2djvu 0.7.17 (DjVuLibre 3,5,25, poppler 0.18.4, GraphicsMagick++ 1.s.15, 
GNOME XSLT 1.1.26, GNOME XML 2.9.1), Debian sid.

Please provide any additional information below.

Original issue reported on code.google.com by jsb...@mimuw.edu.pl on 14 Nov 2013 at 4:52

GoogleCodeExporter commented 9 years ago

Original comment by jwilk@jwilk.net on 21 Nov 2013 at 9:26

GoogleCodeExporter commented 9 years ago

Original comment by jwilk@jwilk.net on 21 Nov 2013 at 9:33

GoogleCodeExporter commented 9 years ago
I've reproduced the segfault.

Original comment by jwilk@jwilk.net on 21 Nov 2013 at 10:27

GoogleCodeExporter commented 9 years ago
Backtrace:

#0  0xb6d02a4c in tcd_decode_tile (tcd=tcd@entry=0xaee4fa30, src=0xaad0f358 
"\343\376}\020\177\371\332/\376{\217?\347Vp\302Ti\304\375\063F2g\033\216\016\346
\222\027S!\200\024(0Kf@\230\n\251\342\331\235\\z\356\267\377G\327$mPn\300\336\23
4-\260\223X\231\344\020I<\365\276\301\244\237\307\376\004x3\326\363\271\034\244#
\330\202,\217\017\316\061\376\365U\264\224Z\312\334e\320?\223\022\300\365hYT\226
\266s\353\210\206\352\302\221\325\002\252\352G\307\200\361\313>%^\356\247\223-3O
\031\263\274\332W\203G{{\312\235\216\235\237\344\366Wn\273\366bL0]O:\250Nx\252\3
57\232\322\016:8\221\343\200r\214\354\252\205(\232\274d\324\001\312\327\240a^=DD
3?\024\375\"\257"..., len=44545, tileno=tileno@entry=0, cstr_info=0x0) at 
libopenjpeg/tcd.c:1459
#1  0xb6cf0531 in j2k_read_eoc (j2k=0xb184d950) at libopenjpeg/j2k.c:1591
#2  0xb6cf2039 in j2k_decode (j2k=0xb184d950, cio=cio@entry=0xaaabee68, 
cstr_info=cstr_info@entry=0x0) at libopenjpeg/j2k.c:1902
#3  0xb6cf54d2 in jp2_decode (jp2=0xb487b168, cio=cio@entry=0xaaabee68, 
cstr_info=cstr_info@entry=0x0) at libopenjpeg/jp2.c:561
#4  0xb6cf7177 in opj_decode_with_info (dinfo=dinfo@entry=0xab0fccf0, 
cio=cio@entry=0xaaabee68, cstr_info=cstr_info@entry=0x0) at 
libopenjpeg/openjpeg.c:162
#5  0xb6cf71db in opj_decode (dinfo=0xab0fccf0, cio=0xaaabee68) at 
libopenjpeg/openjpeg.c:151
#6  0xb7396e92 in JPXStream::init2 (this=this@entry=0xacdd8aa0, 
buf=buf@entry=0xaad04410 "", bufLen=bufLen@entry=44863, 
format=format@entry=CODEC_JP2) at JPEG2000Stream.cc:157
#7  0xb73970d8 in JPXStream::init (this=this@entry=0xacdd8aa0) at 
JPEG2000Stream.cc:80
#8  0xb7397360 in JPXStream::getImageParams (this=0xacdd8aa0, 
bitsPerComponent=0xbfeaced8, csMode=0xbfeacedc) at JPEG2000Stream.cc:190
#9  0xb73d1cda in Gfx::doImage (this=this@entry=0xbc0c4e28, 
ref=ref@entry=0xbfead078, str=0xacdd8aa0, inlineImg=inlineImg@entry=false) at 
Gfx.cc:4070
#10 0xb73d41e1 in Gfx::opXObject (this=0xbc0c4e28, args=0xbfead154, numArgs=1) 
at Gfx.cc:4017
#11 0xb73c4632 in Gfx::execOp (this=this@entry=0xbc0c4e28, 
cmd=cmd@entry=0xbfead134, args=args@entry=0xbfead154, numArgs=numArgs@entry=1) 
at Gfx.cc:852
#12 0xb73cc961 in Gfx::go (this=this@entry=0xbc0c4e28, 
topLevel=topLevel@entry=true) at Gfx.cc:712
#13 0xb73cce7c in Gfx::display (this=this@entry=0xbc0c4e28, 
obj=obj@entry=0xbfead3c4, topLevel=topLevel@entry=true) at Gfx.cc:679
#14 0xb740c27b in Page::displaySlice (this=this@entry=0xbe927718, 
out=out@entry=0xb8ba3c28, hDPI=hDPI@entry=300, vDPI=vDPI@entry=300, 
rotate=rotate@entry=0, useMediaBox=useMediaBox@entry=false, 
crop=crop@entry=true, sliceX=sliceX@entry=-1, sliceY=sliceY@entry=-1, 
sliceW=sliceW@entry=-1, sliceH=sliceH@entry=-1, printing=printing@entry=true, 
catalog=catalog@entry=0xb8ba3b78, abortCheckCbk=abortCheckCbk@entry=0x0, 
abortCheckCbkData=abortCheckCbkData@entry=0x0, 
annotDisplayDecideCbk=annotDisplayDecideCbk@entry=0x0, 
annotDisplayDecideCbkData=annotDisplayDecideCbkData@entry=0x0) at Page.cc:483
#15 0xb740c443 in Page::display (this=0xbe927718, out=out@entry=0xb8ba3c28, 
hDPI=hDPI@entry=300, vDPI=vDPI@entry=300, rotate=rotate@entry=0, 
useMediaBox=useMediaBox@entry=false, crop=crop@entry=true, 
printing=printing@entry=true, catalog=0xb8ba3b78, 
abortCheckCbk=abortCheckCbk@entry=0x0, 
abortCheckCbkData=abortCheckCbkData@entry=0x0, 
annotDisplayDecideCbk=annotDisplayDecideCbk@entry=0x0, 
annotDisplayDecideCbkData=annotDisplayDecideCbkData@entry=0x0) at Page.cc:412
#16 0xb741200e in PDFDoc::displayPage (this=this@entry=0xb8ba37d0, 
out=out@entry=0xb8ba3c28, page=page@entry=220, hDPI=300, vDPI=300, 
rotate=rotate@entry=0, useMediaBox=false, crop=crop@entry=true, printing=true, 
abortCheckCbk=abortCheckCbk@entry=0x0, 
abortCheckCbkData=abortCheckCbkData@entry=0x0, annotDisplayDecideCbk=0x0, 
annotDisplayDecideCbkData=0x0) at PDFDoc.cc:437
#17 0xb76e4277 in pdf::Document::display_page (this=0xb8ba37d0, 
renderer=0xb8ba3c28, npage=220, hdpi=300, vdpi=300, crop=true, do_links=false) 
at pdf-backend.cc:218
#18 0xb76eb7cd in xmain(int, char* const*) [clone ._omp_fn.0] () at 
pdf2djvu.cc:1429
#19 0xb76ef5c9 in xmain (argc=argc@entry=4, argv=argv@entry=0xbfeae474) at 
pdf2djvu.cc:1373
#20 0xb76d608a in main (argc=4, argv=0xbfeae474) at pdf2djvu.cc:1727

Original comment by jwilk@jwilk.net on 27 Nov 2013 at 10:50

GoogleCodeExporter commented 9 years ago
What are the prospects of have it fixed?

Best regards

JSB

Original comment by jsb...@mimuw.edu.pl on 12 Jan 2014 at 11:25

GoogleCodeExporter commented 9 years ago
I haven't been able to pin down the cause, and I'm rather pessimistic about it.

Original comment by jwilk@jwilk.net on 12 Jan 2014 at 11:44

GoogleCodeExporter commented 9 years ago

Original comment by jwilk@jwilk.net on 7 Sep 2014 at 8:28

GoogleCodeExporter commented 9 years ago
Curiously enough, on today's sid it fails earlier and differently:

- page #205 -> #205
  - rendering page (1st pass)
  - image size: 2667x3604
  - rendering page (2nd pass)
PDF syntax error: Out of memory<0a>
PDF syntax error: Failed to decode J2K image<0a>
PDF syntax warning: Did no succeed opening JPX Stream as JP2, trying as J2K.
PDF syntax error: 00000000: expected a marker instead of 0<0a>
PDF syntax warning: Did no succeed opening JPX Stream as J2K, trying as JPT.
PDF syntax error: Forbidden value encounter in message header !!<0a>
PDF syntax error: [JPT-stream] : Expecting Main header first [class_Id 0] !<0a>
PDF syntax error: Did no succeed opening JPX Stream.
  - preparing data for `csepdjvu`
    - storing foreground image
    - rendering background image
PDF syntax error: Out of memory<0a>
PDF syntax error: Failed to decode J2K image<0a>
PDF syntax warning: Did no succeed opening JPX Stream as JP2, trying as J2K.
PDF syntax error: 00000000: expected a marker instead of 0<0a>
PDF syntax warning: Did no succeed opening JPX Stream as J2K, trying as JPT.
PDF syntax error: Forbidden value encounter in message header !!<0a>
PDF syntax error: [JPT-stream] : Expecting Main header first [class_Id 0] !<0a>
PDF syntax error: Did no succeed opening JPX Stream.
    - storing background image
    - storing text layer
  - encoding layers with `csepdjvu`
terminate called after throwing an instance of 'Command::CommandFailed'
  what():  External command "/usr/bin/csepdjvu ..." failed
Aborted (core dumped)

Original comment by jwilk@jwilk.net on 12 Oct 2014 at 9:21