From 51d95add6a306ea9dc1b0e2dacc202f69e4565e0 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 5 Nov 2022 15:41:17 +1100 Subject: [PATCH] Replaced IOError with OSError --- Tests/oss-fuzz/test_fuzzers.py | 2 +- Tests/test_font_crash.py | 2 +- src/_imagingft.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/oss-fuzz/test_fuzzers.py b/Tests/oss-fuzz/test_fuzzers.py index 1b0b1d3dc..fb8f87e86 100644 --- a/Tests/oss-fuzz/test_fuzzers.py +++ b/Tests/oss-fuzz/test_fuzzers.py @@ -59,6 +59,6 @@ def test_fuzz_fonts(path): fuzzers.fuzz_font(f.read()) except (Image.DecompressionBombError, Image.DecompressionBombWarning, - IOError): + OSError): pass assert True diff --git a/Tests/test_font_crash.py b/Tests/test_font_crash.py index 9a2110c0c..e8d612a7f 100644 --- a/Tests/test_font_crash.py +++ b/Tests/test_font_crash.py @@ -17,6 +17,6 @@ class TestFontCrash: @skip_unless_feature("freetype2") def test_segfault(self): - with pytest.raises(IOError): + with pytest.raises(OSError): font = ImageFont.truetype("Tests/fonts/fuzz_font-5203009437302784") self._fuzz_font(font) diff --git a/src/_imagingft.c b/src/_imagingft.c index 053ef1e7d..0db17a5a6 100644 --- a/src/_imagingft.c +++ b/src/_imagingft.c @@ -923,7 +923,7 @@ font_render(FontObject *self, PyObject *args) { // Null buffer, is dereferenced in FT_Bitmap_Convert if (!bitmap.buffer && bitmap.rows) { - PyErr_SetString(PyExc_IOError, "Bitmap missing for glyph"); + PyErr_SetString(PyExc_OSError, "Bitmap missing for glyph"); goto glyph_error; }