Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-07-29 07:09:30 +0300
committerJeroen Bakker <jeroen@blender.org>2021-08-09 09:13:05 +0300
commitbc627fbf657e6b35116505f185197d170203552e (patch)
treec10437bdaa4e49af57e528e4551e7604fcdf51a1 /source/blender/python
parent2be2aeaf0a515edc75e8c744a82cf8a921a6ab38 (diff)
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.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/gpu/gpu_py_texture.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/python/gpu/gpu_py_texture.c b/source/blender/python/gpu/gpu_py_texture.c
index 257c6d773eb..48802ab9407 100644
--- a/source/blender/python/gpu/gpu_py_texture.c
+++ b/source/blender/python/gpu/gpu_py_texture.c
@@ -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;
}