From e312868c4edab227b772f4795e8adff96da4bf4d Mon Sep 17 00:00:00 2001 From: jvoisin Date: Mon, 13 Dec 2021 19:00:41 +0100 Subject: Increase a bit the robustness of mat2 Those issues were found via https://github.com/google/atheris --- libmat2/images.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libmat2/images.py') 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): } 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, -- cgit v1.3