Commit de65f4f4 authored by jvoisin's avatar jvoisin

Improve the resilience of MAT2 wrt. corrupted PNG

parent 759efa03
Pipeline #24463 failed with stages
in 2 minutes and 35 seconds
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment