Increase a bit the robustness of mat2
Those issues were found via https://github.com/google/atheris
This commit is contained in:
parent
b71bafd2cf
commit
e312868c4e
@ -13,7 +13,8 @@ class MutagenParser(abstract.AbstractParser):
|
|||||||
def __init__(self, filename):
|
def __init__(self, filename):
|
||||||
super().__init__(filename)
|
super().__init__(filename)
|
||||||
try:
|
try:
|
||||||
mutagen.File(self.filename)
|
if mutagen.File(self.filename) is None:
|
||||||
|
raise ValueError
|
||||||
except mutagen.MutagenError:
|
except mutagen.MutagenError:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
|
|
||||||
|
@ -26,7 +26,10 @@ class SVGParser(exiftool.ExiftoolParser):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def remove_all(self) -> bool:
|
def remove_all(self) -> bool:
|
||||||
|
try:
|
||||||
svg = Rsvg.Handle.new_from_file(self.filename)
|
svg = Rsvg.Handle.new_from_file(self.filename)
|
||||||
|
except GLib.GError:
|
||||||
|
raise ValueError
|
||||||
dimensions = svg.get_dimensions()
|
dimensions = svg.get_dimensions()
|
||||||
surface = cairo.SVGSurface(self.output_filename,
|
surface = cairo.SVGSurface(self.output_filename,
|
||||||
dimensions.height,
|
dimensions.height,
|
||||||
|
Loading…
Reference in New Issue
Block a user