mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-24 08:14:10 +03:00
check type given to ImageCms.core.profile_tobytes instead of crashing
This commit is contained in:
parent
e7eea5ea30
commit
24ed5db2d1
|
@ -506,6 +506,12 @@ def test_profile_typesafety() -> None:
|
||||||
with pytest.raises(TypeError, match="Invalid type for Profile"):
|
with pytest.raises(TypeError, match="Invalid type for Profile"):
|
||||||
ImageCms.ImageCmsProfile(1).tobytes()
|
ImageCms.ImageCmsProfile(1).tobytes()
|
||||||
|
|
||||||
|
# also check core function
|
||||||
|
with pytest.raises(TypeError):
|
||||||
|
ImageCms.core.profile_tobytes(0)
|
||||||
|
with pytest.raises(TypeError):
|
||||||
|
ImageCms.core.profile_tobytes(1)
|
||||||
|
|
||||||
|
|
||||||
def assert_aux_channel_preserved(
|
def assert_aux_channel_preserved(
|
||||||
mode: str, transform_in_place: bool, preserved_channel: str
|
mode: str, transform_in_place: bool, preserved_channel: str
|
||||||
|
|
|
@ -143,7 +143,7 @@ cms_profile_tobytes(PyObject *self, PyObject *args) {
|
||||||
cmsHPROFILE *profile;
|
cmsHPROFILE *profile;
|
||||||
|
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
if (!PyArg_ParseTuple(args, "O", &CmsProfile)) {
|
if (!PyArg_ParseTuple(args, "O!", &CmsProfile_Type, &CmsProfile)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user