summaryrefslogtreecommitdiff
path: root/libmat2
diff options
context:
space:
mode:
authorjvoisin2021-12-13 19:00:41 +0100
committerjvoisin2021-12-13 19:00:41 +0100
commite312868c4edab227b772f4795e8adff96da4bf4d (patch)
tree734340fd47f0f15d43404bc8a3a48f4b3390af57 /libmat2
parentb71bafd2cfaec838844447676f9fae30abe432ef (diff)
Increase a bit the robustness of mat2
Those issues were found via https://github.com/google/atheris
Diffstat (limited to 'libmat2')
-rw-r--r--libmat2/audio.py3
-rw-r--r--libmat2/images.py5
2 files changed, 6 insertions, 2 deletions
diff --git a/libmat2/audio.py b/libmat2/audio.py
index bd7add9..3f3a757 100644
--- a/libmat2/audio.py
+++ b/libmat2/audio.py
@@ -13,7 +13,8 @@ class MutagenParser(abstract.AbstractParser):
13 def __init__(self, filename): 13 def __init__(self, filename):
14 super().__init__(filename) 14 super().__init__(filename)
15 try: 15 try:
16 mutagen.File(self.filename) 16 if mutagen.File(self.filename) is None:
17 raise ValueError
17 except mutagen.MutagenError: 18 except mutagen.MutagenError:
18 raise ValueError 19 raise ValueError
19 20
diff --git a/libmat2/images.py b/libmat2/images.py
index e55b765..c584c1c 100644
--- a/libmat2/images.py
+++ b/libmat2/images.py
@@ -26,7 +26,10 @@ class SVGParser(exiftool.ExiftoolParser):
26 } 26 }
27 27
28 def remove_all(self) -> bool: 28 def remove_all(self) -> bool:
29 svg = Rsvg.Handle.new_from_file(self.filename) 29 try:
30 svg = Rsvg.Handle.new_from_file(self.filename)
31 except GLib.GError:
32 raise ValueError
30 dimensions = svg.get_dimensions() 33 dimensions = svg.get_dimensions()
31 surface = cairo.SVGSurface(self.output_filename, 34 surface = cairo.SVGSurface(self.output_filename,
32 dimensions.height, 35 dimensions.height,