Skip to content
Snippets Groups Projects
Commit de65f4f4 authored by Julien (jvoisin) Voisin's avatar Julien (jvoisin) Voisin
Browse files

Improve the resilience of MAT2 wrt. corrupted PNG

parent 759efa03
No related branches found
No related tags found
No related merge requests found
......@@ -62,6 +62,10 @@ class PNGParser(_ImageParser):
def __init__(self, filename):
super().__init__(filename)
if imghdr.what(filename) != 'png':
raise ValueError
try: # better fail here than later
cairo.ImageSurface.create_from_png(self.filename)
except MemoryError:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment