1
0
mirror of synced 2024-11-21 16:54:23 +01:00

Increase a bit the robustness of mat2

Those issues were found via https://github.com/google/atheris
This commit is contained in:
jvoisin 2021-12-13 19:00:41 +01:00
parent b71bafd2cf
commit e312868c4e
2 changed files with 6 additions and 2 deletions

View File

@ -13,7 +13,8 @@ class MutagenParser(abstract.AbstractParser):
def __init__(self, filename):
super().__init__(filename)
try:
mutagen.File(self.filename)
if mutagen.File(self.filename) is None:
raise ValueError
except mutagen.MutagenError:
raise ValueError

View File

@ -26,7 +26,10 @@ class SVGParser(exiftool.ExiftoolParser):
}
def remove_all(self) -> bool:
svg = Rsvg.Handle.new_from_file(self.filename)
try:
svg = Rsvg.Handle.new_from_file(self.filename)
except GLib.GError:
raise ValueError
dimensions = svg.get_dimensions()
surface = cairo.SVGSurface(self.output_filename,
dimensions.height,