Bug 100724

Summary: pdftocairo: Assertion `!scaled_font->cache_frozen' failed
Product: poppler Reporter: Alex Korobkin <korobkin+lpad>
Component: cairo backendAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: pdf-assertion-failed.pdf

Description Alex Korobkin 2017-04-19 14:47:20 UTC
Created attachment 130918 [details]
pdf-assertion-failed.pdf

When converting this PDF to level3 PostScript, pdftocairo dumps core with this message

pdftocairo: /tmp/build-debs.brV892/build/src/cairo-scaled-font.c:459: _cairo_scaled_glyph_page_destroy: Assertion `!scaled_font->cache_frozen' failed.

libcairo2 1.14.8
poppler 0.53.0
Ubuntu 14.04 x64

Whole stack from GDB:

(gdb) run
Starting program: /usr/bin/pdftocairo -ps -level3 pdf-assertion-failed.pdf out.ps
[Thread debugging using libthread_db enabled]

pdftocairo: /tmp/build-debs.brV892/build/src/cairo-scaled-font.c:459: _cairo_scaled_glyph_page_destroy: Assertion `!scaled_font->cache_frozen' failed.

Program received signal SIGABRT, Aborted.
0x00007ffff6511c37 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0  0x00007ffff6511c37 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff6515028 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x00007ffff650abf6 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3  0x00007ffff650aca2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#4  0x00007ffff73ab564 in _cairo_scaled_glyph_page_destroy (scaled_font=0x555555915960, page=0x55555591bc60) at /tmp/build-debs.brV892/build/src/cairo-scaled-font.c:459
#5  0x00007ffff73aff58 in _cairo_scaled_font_free_last_glyph (scaled_font=0x555555915960, scaled_glyph=0x55555591bc88) at /tmp/build-debs.brV892/build/src/cairo-scaled-font.c:2924
#6  0x00007ffff73b009e in _cairo_scaled_glyph_lookup (scaled_font=0x555555915960, index=0, info=CAIRO_SCALED_GLYPH_INFO_METRICS, scaled_glyph_ret=0x7fffffffbb08)
    at /tmp/build-debs.brV892/build/src/cairo-scaled-font.c:2998
#7  0x00007ffff73ae871 in _cairo_scaled_font_single_glyph_device_extents (scaled_font=0x555555915960, glyph=0x7fffffffc470, extents=0x7fffffffbe8c)
    at /tmp/build-debs.brV892/build/src/cairo-scaled-font.c:2179
#8  0x00007ffff73aea69 in _cairo_scaled_font_glyph_device_extents (scaled_font=0x555555915960, glyphs=0x7fffffffc470, num_glyphs=1, extents=0x7fffffffbe8c, overlap_out=0x0)
    at /tmp/build-debs.brV892/build/src/cairo-scaled-font.c:2231
#9  0x00007ffff7352b9d in _cairo_composite_rectangles_init_for_glyphs (extents=0x7fffffffbe70, surface=0x5555557b9580, op=CAIRO_OPERATOR_OVER, source=0x7fffffffc350, 
    scaled_font=0x555555915960, glyphs=0x7fffffffc470, num_glyphs=1, clip=0x5555557b9eb0, overlap=0x0) at /tmp/build-debs.brV892/build/src/cairo-composite-rectangles.c:447
#10 0x00007ffff73a3aa9 in _cairo_recording_surface_show_text_glyphs (abstract_surface=0x5555557b9580, op=CAIRO_OPERATOR_OVER, source=0x7fffffffc350, 
    utf8=0x5555557e0c60 "Alj\366\377\177", utf8_len=1, glyphs=0x7fffffffc470, num_glyphs=1, clusters=0x7fffffffcc70, num_clusters=1, cluster_flags=(unknown: 0), 
    scaled_font=0x555555915960, clip=0x5555557b9eb0) at /tmp/build-debs.brV892/build/src/cairo-recording-surface.c:1012
#11 0x00007ffff73ba52d in _cairo_surface_show_text_glyphs (surface=0x5555557b9580, op=CAIRO_OPERATOR_OVER, source=0x7fffffffc350, utf8=0x5555557e0c60 "Alj\366\377\177", 
    utf8_len=1, glyphs=0x7fffffffc470, num_glyphs=1, clusters=0x7fffffffcc70, num_clusters=1, cluster_flags=(unknown: 0), scaled_font=0x555555915960, clip=0x5555557b9eb0)
    at /tmp/build-debs.brV892/build/src/cairo-surface.c:2580
#12 0x00007ffff737c413 in _cairo_paginated_surface_show_text_glyphs (abstract_surface=0x5555557a9010, op=CAIRO_OPERATOR_OVER, source=0x7fffffffc350, 
    utf8=0x5555557e0c60 "Alj\366\377\177", utf8_len=1, glyphs=0x7fffffffc470, num_glyphs=1, clusters=0x7fffffffcc70, num_clusters=1, cluster_flags=(unknown: 0), 
    scaled_font=0x555555915960, clip=0x5555557b9eb0) at /tmp/build-debs.brV892/build/src/cairo-paginated-surface.c:642
#13 0x00007ffff73ba52d in _cairo_surface_show_text_glyphs (surface=0x5555557a9010, op=CAIRO_OPERATOR_OVER, source=0x7fffffffc350, utf8=0x5555557e0c60 "Alj\366\377\177", 
    utf8_len=1, glyphs=0x7fffffffc470, num_glyphs=1, clusters=0x7fffffffcc70, num_clusters=1, cluster_flags=(unknown: 0), scaled_font=0x555555915960, clip=0x5555557b9eb0)
    at /tmp/build-debs.brV892/build/src/cairo-surface.c:2580
#14 0x00007ffff735f174 in _cairo_gstate_show_text_glyphs (gstate=0x5555557e3b60, glyphs=0x55555590c900, num_glyphs=1, info=0x7fffffffd740)
    at /tmp/build-debs.brV892/build/src/cairo-gstate.c:2015
#15 0x00007ffff7357753 in _cairo_default_context_glyphs (abstract_cr=0x5555557b9760, glyphs=0x55555590c900, num_glyphs=1, info=0x7fffffffd740)
    at /tmp/build-debs.brV892/build/src/cairo-default-context.c:1297
#16 0x00007ffff734c9c9 in cairo_show_text_glyphs (cr=0x5555557b9760, utf8=0x5555557e0c60 "Alj\366\377\177", utf8_len=1, glyphs=0x55555590c900, num_glyphs=1, 
    clusters=0x555555913550, num_clusters=1, cluster_flags=(unknown: 0)) at /tmp/build-debs.brV892/build/src/cairo.c:3424
#17 0x00005555555635cb in CairoOutputDev::endString (this=0x5555557aa8b0, state=<optimized out>) at CairoOutputDev.cc:1455
#18 0x00007ffff7a65b69 in Gfx::doShowText (this=this@entry=0x5555557b9d00, s=0x55555588a190) at Gfx.cc:4125
#19 0x00007ffff7a664a9 in Gfx::opShowText (this=0x5555557b9d00, args=0x7fffffffda00, numArgs=<optimized out>) at Gfx.cc:3825
#20 0x00007ffff7a5e459 in Gfx::go (this=this@entry=0x5555557b9d00, topLevel=topLevel@entry=true) at Gfx.cc:763
#21 0x00007ffff7a5e89d in Gfx::display (this=this@entry=0x5555557b9d00, obj=obj@entry=0x7fffffffdd00, topLevel=topLevel@entry=true) at Gfx.cc:729
#22 0x00007ffff7aa67e8 in Page::displaySlice (this=0x5555557a8f40, out=0x5555557aa8b0, hDPI=72, vDPI=72, rotate=<optimized out>, useMediaBox=<optimized out>, 
    crop=<optimized out>, sliceX=<optimized out>, sliceY=-1, sliceW=-1, sliceH=-1, printing=true, abortCheckCbk=0x0, abortCheckCbkData=0x0, annotDisplayDecideCbk=0x0, 
    annotDisplayDecideCbkData=0x0, copyXRef=false) at Page.cc:601
#23 0x000055555555fb49 in renderPage (output_h=841.91999999999996, output_w=594.95999999999992, page_h=<optimized out>, page_w=<optimized out>, pg=1, cairoOut=0x5555557aa8b0, 
    doc=0x5555557afdb0) at pdftocairo.cc:673
#24 main (argc=3, argv=<optimized out>) at pdftocairo.cc:1197
(gdb) quit
Comment 1 Jason Crain 2017-04-19 16:40:31 UTC
A Type 3 font in this PDF has an empty CharProcs, so of course the font rendering fails:

    70 0 obj
    <<
      /CharProcs 71 0 R
      ... snip ...
    >>
    endobj
    
    71 0 obj
    <<
    >>
    endobj

The problem is that cairo does not cope well when it's user font rendering returns an error (bug #85141).

*** This bug has been marked as a duplicate of bug 85141 ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.