Segfault when loading EMF file

Bug #168278 reported by Ghaushe
2
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Critical
Unassigned

Bug Description

I get a segfault when trying to load an EMF produced by pstoedit (from a
pdf). Windows opens the EMF correctly.
The message I get when running in gdb is:
#0 0x7c96df51 in ntdll!RtlpNtMakeTemporaryKey () from ntdll.dll
#1 0x02a10000 in ?? ()
#2 0xbaadf00d in ?? ()
#3 0x40000060 in ?? ()
#4 0x0022f0dc in ?? ()
#5 0x0022eab8 in ?? ()
#6 0x00a5b49c in zlib1!zError ()
#7 0x03088ae1 in ?? ()
#8 0x0308866c in ?? ()
#9 0x00000006 in ?? ()
#10 0x00be1960 in zlib1!zError ()
#11 0x00be1e84 in zlib1!zError ()
#12 0x00be1960 in zlib1!zError ()
#13 0x00000228 in ?? ()
#14 0xbaadf005 in ?? ()
#15 0x02a10000 in ?? ()
#16 0xffffffff in ?? ()
#17 0x00000000 in ?? () from
#18 0x00010000 in ?? ()
#19 0x0022ea68 in ?? ()
#20 0x00ae8bc0 in zlib1!zError ()
#21 0x0022eba0 in ?? ()
#22 0x7c90ee18 in strchr () from ntdll.dll
#22 0x7c90ee18 in strchr () from ntdll.dll
#23 0x7c96e0f8 in ntdll!RtlpNtMakeTemporaryKey () from ntdll.dll
#24 0x00000001 in ?? ()
#25 0x0022ebb0 in ?? ()
#26 0x7c94a5d0 in ntdll!RtlInsertElementGenericTableAvl () from ntdll.dll
#27 0x02a10000 in ?? ()
#28 0x50000061 in ?? ()
#29 0xbaadf00d in ?? ()
#30 0x02a10000 in ?? ()
#31 0xbaadf00d in ?? ()
#32 0x40000060 in ?? ()
#33 0x40000060 in ?? ()
#34 0x77c2c3ce in msvcrt!free () from C:\WINNT\system32\msvcrt.dll
#35 0x6655e178 in std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::all
ocator<wchar_t> >::_Rep::_S_empty_rep_storage ()
#36 0x00000000 in ?? () from
#37 0x0000003d in ?? ()
#38 0x00aad675 in zlib1!zError ()
#39 0x0022eb18 in ?? ()
#40 0x0022eaf0 in ?? ()
#41 0x7c910570 in ntdll!RtlFreeThreadActivationContextStack () from
ntdll.dll
#42 0x0022ffe0 in ?? ()
#43 0x77c35c94 in msvcrt!_except_handler2 () from
C:\WINNT\system32\msvcrt.dll

If I load it interactively I get:
** ERROR **: file src/xml/simple-node.h: line 34 (virtual void
Inkscape::XML::SimpleNode::setCodeUnsafe(int)): assertion failed(_document
== NULL)

The file is pretty large (~2MB) and contains personal information, so I'm
not going to upload my test-case

Revision history for this message
Ghaushe (ghaushe) wrote :

Originator: YES

By the way I am running the latest daily snapshot as of 1/25/2007

Revision history for this message
Bug Importer (bug-importer) wrote :

> The file is pretty large (~2MB) and contains personal information,
> so I'm not going to upload my test-case

Why don't you try to reproduce the same with a similar, but smaller, Pdf
(without personal information)?

Revision history for this message
Ghaushe (ghaushe) wrote :

Originator: YES

I'm adding an SVG and an EMF generated by Inkscape from the SVG (save-as
EMF) that gives the same error.
These aren't the same as the one I originally reported (which was much
larger and more complicated).
Also, the EMF shows an issue in the Inkscape EMF writer code, in that the
background is black instead of white when displayed in Windows. However,
it does load fine by other Windows apps.

File Added: Test.emf

Revision history for this message
Ghaushe (ghaushe) wrote :

Originator: YES

File Added: Test.svg

Revision history for this message
Bug Importer (bug-importer) wrote :

> I'm adding an SVG and an EMF generated by Inkscape from the SVG
> (save-as EMF) that gives the same error.

Thanks. But it doesn't crash for me
Windows 2000 Pro, Inkscape 0.45

> These aren't the same as the one I originally reported
> (which was much larger and more complicated).

Unless the very size is the problem it is often a matter of finding that
one feature that isn't handled correctly. You could try removing one layer
at a time to find which layer cause the problem. And then remove half of
the objects at a time until you find what object is so badly exported that
it cannot be read back. After that it should be fairly easy to fix.

> Also, the EMF shows an issue in the Inkscape EMF writer code,
> in that the background is black instead of white when displayed
> in Windows. However, it does load fine by other Windows apps.

You can better use "no fill" instead of transparent to only see the
contours of objects. Several of the other output formats doesn't support
transparency either and show the very same black fills.

I guess one could assume a white background and calculate a grey-level for
constant transparencies, or at least special case 100% transparency..

Revision history for this message
Ghaushe (ghaushe) wrote :

Originator: YES

Yes 0.45 fixes the crash in both the test and the original EMF. However,
the original EMF is not loading into Inkspace properly. If I view the emf
in other apps, it has a full 24"x36" page filled with text and line
drawings. In Inkscape I get only a few words of text. I have decided to
attach it, as it's really not that personal.
FWIW what I am trying to do is to modify an existing PDF in Inkscape so
that I can tweak the borders a little for printing. As there is no easy
(free) way to convert PDF to SVG, I'm tying to go through an intermediate
format, and EMF is supported by both Inkscape and pstoedit

Revision history for this message
Ghaushe (ghaushe) wrote :

Originator: YES

File Added: A00_COVER.7z

Revision history for this message
Bug Importer (bug-importer) wrote :

Thanks. The importer doesn't recognize much more of Emf than what the
exporter uses (and that is not much). Your Emf has a lot of PolyPolygons.
I'll add that one day to see how far that helps.

For your needs you might want to look for pdf2svg (or pdftosvg?) based on
Poppler+Cairo.
Or see what wmf2svg (from libwmf?) can do with your Emf file.
Other options would be to create a postscript from pstoedit and convert it
to svg with Scribus.
Or output a .sk file from pstoedit and convert it to svg with Skencil.

Revision history for this message
Ghaushe (ghaushe) wrote :

Originator: YES

I've tried all those options (except using Scribus) without much luck.
However, as the segfault is gone, what is left is really a
feature-enhancement request, so you should set the priority accordingly.
Thanks for your help.

Revision history for this message
Bug Importer (bug-importer) wrote :

I've got some code for the PolyPolygons now and also MoveTo/LineTo pairs
without BeginPath/EndPath groups, but your Emf also contains a lot of text.
That might come later, but not now..

To get smaller test examples I did install the Windows version of
pstoedit. It comes with two Svg backends: 'svg' and 'plot-svg'. Did you try
both?

Revision history for this message
Ghaushe (ghaushe) wrote :

Originator: YES

The plot-svg did a horrible job, and wasn't usable. the 'svg' worked ok
as I recall, but is unusable for my purposes due to the shareware version
corrupting the output.

Revision history for this message
Dmusil (dmusil) wrote :

Originator: NO

NOT REPRODUCIBLE in latest Inkscape 0.45.1, built Mar 21 2007 and Win XP
SP2, but the result is not good.
Lot of object become lost from the file.
The bugfix solved the crash by reading termination and displaying what
stays after. I think, there should be real fix of that functionality. If
there is no power to fix it now, correct will be to get a message "Error
reading file".

Revision history for this message
Buliabyak-users (buliabyak-users) wrote :

Originator: NO

crash fixed, closing

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

Other bug subscribers

Remote bug watches

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