Fix gpu.types.GPUTexture crash when the size argument was too big
Missing length check on the size argument before copying it into a fixed size buffer.
This commit is contained in:
parent
2be2aeaf0a
commit
bc627fbf65
Notes:
blender-bot
2023-02-14 01:35:49 +01:00
Referenced by issue #88449, Blender LTS: Maintenance Task 2.93
|
@ -153,6 +153,12 @@ static PyObject *pygpu_texture__tp_new(PyTypeObject *UNUSED(self), PyObject *arg
|
|||
int len = 1;
|
||||
if (PySequence_Check(py_size)) {
|
||||
len = PySequence_Size(py_size);
|
||||
if ((len < 1) || (len > 3)) {
|
||||
PyErr_Format(PyExc_ValueError,
|
||||
"GPUTexture.__new__: \"size\" must be between 1 and 3 in length (got %d)",
|
||||
len);
|
||||
return NULL;
|
||||
}
|
||||
if (PyC_AsArray(size, py_size, len, &PyLong_Type, false, "GPUTexture.__new__") == -1) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue