Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Buffer overflow in xkcd example with pdf backend.  #4230

Copy link
Copy link
Closed
@jenshnielsen

Description

@jenshnielsen
Issue body actions

I am seeing a buffer overflow bug when building the docs with pdf files in the XKCD example.

import matplotlib.pyplot as plt
import numpy as np

with plt.xkcd():
    # Based on "The Data So Far" from XKCD by Randall Monroe
    # http://xkcd.com/373/

    fig = plt.figure()
    ax = fig.add_axes((0.1, 0.2, 0.8, 0.7))
    ax.bar([-0.125, 1.0 - 0.125], [0, 100], 0.25)
    ax.spines['right'].set_color('none')
    ax.spines['top'].set_color('none')
    ax.xaxis.set_ticks_position('bottom')
    ax.set_xticks([0, 1])
    ax.set_xlim([-0.5, 1.5])
    ax.set_ylim([0, 110])
    ax.set_xticklabels(['CONFIRMED BY\nEXPERIMENT', 'REFUTED BY\nEXPERIMENT'])
    plt.yticks([])

    plt.title("CLAIMS OF SUPERNATURAL POWERS")

    fig.text(
        0.5, 0.05,
        '"The Data So Far" from xkcd by Randall Monroe',
        ha='center')
    plt.savefig('test.pdf')

Results in:

Traceback (most recent call last):
  File "xkcd.py", line 26, in <module>
    plt.savefig('test.pdf')
  File "/Users/jhn/Envs/mplstable/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.10-x86_64.egg/matplotlib/pyplot.py", line 576, in savefig
    res = fig.savefig(*args, **kwargs)
  File "/Users/jhn/Envs/mplstable/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.10-x86_64.egg/matplotlib/figure.py", line 1490, in savefig
    self.canvas.print_figure(*args, **kwargs)
  File "/Users/jhn/Envs/mplstable/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.10-x86_64.egg/matplotlib/backend_bases.py", line 2213, in print_figure
    **kwargs)
  File "/Users/jhn/Envs/mplstable/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.10-x86_64.egg/matplotlib/backends/backend_pdf.py", line 2509, in print_pdf
    self.figure.draw(renderer)
  File "/Users/jhn/Envs/mplstable/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.10-x86_64.egg/matplotlib/artist.py", line 60, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/Users/jhn/Envs/mplstable/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.10-x86_64.egg/matplotlib/figure.py", line 1032, in draw
    self.patch.draw(renderer)
  File "/Users/jhn/Envs/mplstable/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.10-x86_64.egg/matplotlib/artist.py", line 60, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "/Users/jhn/Envs/mplstable/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.10-x86_64.egg/matplotlib/patches.py", line 484, in draw
    renderer.draw_path(gc, tpath, affine, rgbFace)
  File "/Users/jhn/Envs/mplstable/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.10-x86_64.egg/matplotlib/patheffects.py", line 107, in draw_path
    rgbFace)
  File "/Users/jhn/Envs/mplstable/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.10-x86_64.egg/matplotlib/patheffects.py", line 208, in draw_path
    Stroke.draw_path(self, renderer, gc, tpath, affine, rgbFace)
  File "/Users/jhn/Envs/mplstable/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.10-x86_64.egg/matplotlib/patheffects.py", line 197, in draw_path
    renderer.draw_path(gc0, tpath, trans, rgbFace)
  File "/Users/jhn/Envs/mplstable/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.10-x86_64.egg/matplotlib/backends/backend_pdf.py", line 1611, in draw_path
    gc.get_sketch_params())
  File "/Users/jhn/Envs/mplstable/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.10-x86_64.egg/matplotlib/backends/backend_pdf.py", line 1416, in writePath
    sketch=sketch)
  File "/Users/jhn/Envs/mplstable/lib/python3.4/site-packages/matplotlib-1.5.dev1-py3.4-macosx-10.10-x86_64.egg/matplotlib/backends/backend_pdf.py", line 1406, in pathOperations
    True))]
MemoryError: Buffer overflow

I have bisected this down to the merge of #4197 specifically cc41bff

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.