Skip to content

Commit d305ee6

Browse files
authored
Check PyType_Ready return values (#9502)
1 parent da729c8 commit d305ee6

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/_imagingcms.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,8 +1447,9 @@ setup_module(PyObject *m) {
14471447
int vn;
14481448

14491449
/* Ready object types */
1450-
PyType_Ready(&CmsProfile_Type);
1451-
PyType_Ready(&CmsTransform_Type);
1450+
if (PyType_Ready(&CmsProfile_Type) < 0 || PyType_Ready(&CmsTransform_Type) < 0) {
1451+
return -1;
1452+
}
14521453

14531454
Py_INCREF(&CmsProfile_Type);
14541455
PyModule_AddObject(m, "CmsProfile", (PyObject *)&CmsProfile_Type);

src/_imagingft.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1545,7 +1545,9 @@ setup_module(PyObject *m) {
15451545
d = PyModule_GetDict(m);
15461546

15471547
/* Ready object type */
1548-
PyType_Ready(&Font_Type);
1548+
if (PyType_Ready(&Font_Type) < 0) {
1549+
return -1;
1550+
}
15491551

15501552
if (FT_Init_FreeType(&library)) {
15511553
return 0; /* leave it uninitialized */

0 commit comments

Comments
 (0)