crash importing all pdfs - dev build

Bug #229524 reported by Rygle
18
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
High
Unassigned

Bug Description

Whenever I try and import a PDF on the dev build, it displays a preview of the PDF, but when I click OK on the import dialogue, I get a crash.

I'm on Windows XP SP2, using the latest SVN and devlibs. I'm pretty sure it's not just my build environment, as this also occurs on the latest dev builds from http://inkscape.modevia.com/win32/ - I'm also pretty sure it's not my system in general, because it does not occur using the standard 0.46 on the same system.

This is different to https://bugs.launchpad.net/inkscape/+bug/229412 as it occurs on all pdfs, including both the test files attached to that bug.

Backtrace using gdb gives me this;
=======
Program received signal SIGSEGV, Segmentation fault.
0x70cc1559 in GfxPath::moveTo (this=0x0, x=21.600000000000001, y=18)
    at GfxState.cc:3746
3746 GfxState.cc: No such file or directory.
        in GfxState.cc
Current language: auto; currently c++
(gdb) bt
#0 0x70cc1559 in GfxPath::moveTo (this=0x0, x=21.600000000000001, y=18)
    at GfxState.cc:3746
#1 0x00703676 in PdfParser::opRectangle ()
#2 0x007004b5 in PdfParser::go ()
#3 0x0070089b in PdfParser::parse ()
#4 0x0052940d in _fu2__globalParams ()
#5 0x06f81c68 in ?? ()
#6 0x0022edc8 in ?? ()
#7 0x00000001 in ?? ()
#8 0x00000006 in ?? ()
Cannot access memory at address 0x3fe00004
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x70cc1559 in GfxPath::moveTo (this=0x0, x=21.600000000000001, y=18)
    at GfxState.cc:3746
3746 in GfxState.cc
(gdb) bt
#0 0x70cc1559 in GfxPath::moveTo (this=0x0, x=21.600000000000001, y=18)
    at GfxState.cc:3746
#1 0x00703676 in PdfParser::opRectangle ()
#2 0x007004b5 in PdfParser::go ()
#3 0x0070089b in PdfParser::parse ()
#4 0x0052940d in _fu2__globalParams ()
#5 0x06f81c68 in ?? ()
#6 0x0022edc8 in ?? ()
#7 0x00000001 in ?? ()
#8 0x00000006 in ?? ()
Cannot access memory at address 0x3fe00004
(gdb) c
Continuing.

Program exited with code 030000000005.
(gdb)
============

Using inkcl to catch the stderr output I get this;
=======
return code: -1073741819
Error: Couldn't open 'nameToUnicode' file 'C:\target\share\poppler\nameToUnicode
\a'
=======

Rygle (rygle)
Changed in inkscape:
importance: Undecided → High
Revision history for this message
Alvin Penner (apenner) wrote :

identical behaviour here on Win32 nightly build from May 8

Changed in inkscape:
status: New → Confirmed
Revision history for this message
ishmal (ishmalius) wrote :

Heh. If you look at line #0, this=0x0.

Revision history for this message
ishmal (ishmalius) wrote :

If you look at src/extension/internal/pdfinput/pdf-parser.cpp, line 1241:

void PdfParser::opRectangle(Object args[], int numArgs) {
  double x, y, w, h;

  x = args[0].getNum();
  y = args[1].getNum();
  w = args[2].getNum();
  h = args[3].getNum();
  state->moveTo(x, y); <-- HERE
  state->lineTo(x + w, y);
  state->lineTo(x + w, y + h);
  state->lineTo(x, y + h);
  state->closePath();
}

It looks like 'state' is null when state->moveTo(x,y) is called.

Revision history for this message
ishmal (ishmalius) wrote :

After running some debug stuff, I found that the best-looking culprits, PdfParser::saveState() and PdfParser::restoreState() are not the source of this. It must be elsewhere. The next-best clue would be that the "state" variable is being overwritten among the PdfParser data fields.

I think I'm done with this. Anyone who actually knows what's going on in PDF input care to look at this?

Miklos? You around?

Revision history for this message
Alvin Penner (apenner) wrote :

just for fun, created an empty pdf file, tried to import it, got this crash message

C:\Python25\APP>inkcl.py
return code: -1073741819 (hex C0000005)
Error: Couldn't open 'nameToUnicode' file 'C:\target\share\poppler\nameToUnicode\a'
Error: May not be a PDF file (continuing anyway)
Error: PDF file is damaged - attempting to reconstruct xref table...
Error: Couldn't find trailer dictionary
Error: Couldn't read xref table

the implication seems to be that the crash occurred before the file was opened

traceback follows :

(gdb) run
Starting program: C:\Program Files\Inkscape/inkscape.exe
[New thread 2492.0xed4]
[New thread 2492.0xad8]
[New thread 2492.0x9ec]
[New thread 2492.0xfc4]
[New thread 2492.0xb44]
[New thread 2492.0xf10]

Program received signal SIGSEGV, Segmentation fault.
0x00528333 in Inkscape::Extension::Internal::PdfImportDialog::PdfImportDialog
    ()
(gdb) bt
#0 0x00528333 in Inkscape::Extension::Internal::PdfImportDialog::PdfImportDialo
g ()
#1 0x0052a1d9 in _fu2__globalParams ()
#2 0x06bbcd78 in ?? ()
#3 0x06bbdfc0 in ?? ()
#4 0x0505687c in ?? ()
#5 0x00000000 in ?? ()
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x00528333 in Inkscape::Extension::Internal::PdfImportDialog::PdfImportDialog
    ()
(gdb) c
Continuing.

Program exited with code 030000000005.
(gdb)

Revision history for this message
Alvin Penner (apenner) wrote :

sorry, that was not very interesting, next I created a valid .pdf file consisting of the word "Hello", attached here.
backtrace is below :
the only thing that seems to be in common in these three cases is the line
0x0052a4bd in _fu2__globalParams ()

------------------------------

(gdb) run
Starting program: C:\Program Files\Inkscape/inkscape.exe
[New thread 2396.0x744]
[New thread 2396.0x92c]
[New thread 2396.0x460]
[New thread 2396.0x644]
[New thread 2396.0x5c8]
[New thread 2396.0x6c0]

Program received signal SIGSEGV, Segmentation fault.
0x006f95bc in Inkscape::Extension::Internal::SvgBuilder::updateFont ()
(gdb) bt
#0 0x006f95bc in Inkscape::Extension::Internal::SvgBuilder::updateFont ()
#1 0x00702abf in PdfParser::opShowText ()
#2 0x006fd885 in PdfParser::go ()
#3 0x006fdc6b in PdfParser::parse ()
#4 0x0052a4bd in _fu2__globalParams ()
#5 0x06e8d100 in ?? ()
#6 0x0022edd8 in ?? ()
#7 0x00000001 in ?? ()
#8 0x00000006 in ?? ()
Cannot access memory at address 0x3fe00004
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x006f95bc in Inkscape::Extension::Internal::SvgBuilder::updateFont ()
(gdb) c
Continuing.

Program exited with code 030000000005.
(gdb)

Revision history for this message
Alvin Penner (apenner) wrote :

running win32 version of Inkscape 0.46, the pdf file loads properly, but I get the following DOS exit message after a normal exit:

(inkscape.exe:2916): Gtk-CRITICAL **: gtk_file_system_win32_get_info: assertion `g_path_is_absolute (filename)' failed
Error: Couldn't open 'nameToUnicode' file 'C:\target\share\poppler\nameToUnicode\'

the nameToUnicode reference is common to both cases, with or without crash

Revision history for this message
Docsonic (sysadmin-macfarlands) wrote :

I have the exact same problem, WinXP2SP2, inkscape dev build June 5th. I tried using inkscapec.exe (thanks JH!) to see what happened, the result is this....

Open a cmd window and run inkscapec.exe.
Open any pdf document and the preview appears - as the preview window opens, I get an error in the console -

C:\Program Files\Inkscape0.46>inkscapec.exe
Error: Couldn't open 'nameToUnicode' file 'C:\target\share\poppler\nameToUnicode
\a'

(On multiple attempts the path was the same but the 'filename' (a in this case) varied.)

When you accept the pdf preview, inkscape crashes with no other notification to the console.

Is there a possibility that the C:\target\ reference is wrong? I know target is often used as a variable for compiling but C:\target\ doesn't exist on my system so if that is where it is looking then it won't find anything.

I don't know if this helps or not but if there is anything I can try then just let me know,

Thanks,

Tony

Revision history for this message
Ulferikson (ulferikson) wrote :

Looks like a Poppler bug:
http://lists.freedesktop.org/archives/poppler/2008-April/003661.html

Upgrading to latest Poppler plus applying the patch from Bug #237574 solves the crashes for me.

Revision history for this message
Docsonic (sysadmin-macfarlands) wrote :

Any chance of anyone releasing a new set of devlibs to take account of this change? I tried and tried to compile poppler on windows and gave up in the end.

Revision history for this message
Docsonic (sysadmin-macfarlands) wrote :

Pdf import works perfectly for me now . Inkscape SVN 18906/ devlibs SVN 5

Many thanks,

Tony

sas (sas-sas)
Changed in inkscape:
status: Confirmed → Fix Released
Revision history for this message
Alvin Penner (apenner) wrote :

running win32 build Inkscape0806131634.7z.
.pdf import works fine and also Adobe Illustrator 9.0 import works fine,

Many thanks,
Alvin

Revision history for this message
bbyak (buliabyak) wrote :

Can you please give a link to the develibs you're using? I used this one:

http://inkscape.modevia.com/win32libs/devlibs-2.12-svn-0805081735.7z

and still getting a crash on pdf import on XP:

Program received signal SIGSEGV, Segmentation fault.
Inkscape::Extension::Internal::SvgBuilder::updateFont (this=0x10515d20, state=0x10e337d8)
    at c:/devlibs/include/poppler/GfxFont.h:149
149 GooString *getOrigName() { return origName; }
(gdb) bt
#0 Inkscape::Extension::Internal::SvgBuilder::updateFont (this=0x10515d20, state=0x10e337d8)
    at c:/devlibs/include/poppler/GfxFont.h:149
#1 0x006fcfbc in PdfParser::opShowSpaceText (this=0x10515e60, args=0x22f6d8, numArgs=1)
    at src/extension/internal/pdfinput/pdf-parser.cpp:2167
#2 0x006f7fe5 in PdfParser::go (this=0x10515e60, topLevel=1)
    at src/extension/internal/pdfinput/pdf-parser.cpp:410
#3 0x006f83cb in PdfParser::parse (this=0x10515e60, obj=0x22f9a8, topLevel=1)
    at src/extension/internal/pdfinput/pdf-parser.cpp:381
#4 0x00527d9d in _fu2__globalParams () at src/extension/internal/pdfinput/pdf-input.cpp:705
#5 0x004ecce1 in Inkscape::Extension::Input::open (this=0x1050e8a0,
    uri=0x10cedf7c "c:\\inkscape-src\\inkscape\\inkscape\\aaa.pdf")
    at src/extension/input.cpp:159
#6 0x00417195 in Inkscape::Extension::open (key=0x0,
    filename=0x10cedf7c "c:\\inkscape-src\\inkscape\\inkscape\\aaa.pdf")
    at src/extension/system.cpp:93
#7 0x00412f6e in sp_file_open (uri=@0x22fac4, key=0x0, add_to_recent=true, replace_empty=true)
    at src/file.cpp:184
#8 0x004023ae in sp_main_gui (argc=2, argv=0x1045b2f8) at src/main.cpp:767

Revision history for this message
sas (sas-sas) wrote :

That's the right devlibs package. But you need to do svn update on the devlibs directory before you use it, as it's a little out of date. (You will also need to rebuild Inkscape from scratch, due to some binary incompatibilities.)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.