[Bf-blender-cvs] [4dba2060118] master: PyAPI: GPUShader: make 'uniform_vector_*' less restricted

Germano Cavalcante noreply at git.blender.org
Mon Aug 16 18:58:08 CEST 2021


Commit: 4dba2060118b43699a40ae04a66f75ba5f9c745e
Author: Germano Cavalcante
Date:   Mon Aug 16 13:53:56 2021 -0300
Branches: master
https://developer.blender.org/rB4dba2060118b43699a40ae04a66f75ba5f9c745e

PyAPI: GPUShader: make 'uniform_vector_*' less restricted

Buffers larger than required may be allowed without restriction.

===================================================================

M	source/blender/python/gpu/gpu_py_shader.c

===================================================================

diff --git a/source/blender/python/gpu/gpu_py_shader.c b/source/blender/python/gpu/gpu_py_shader.c
index 41c40fdeb96..145586d8ab0 100644
--- a/source/blender/python/gpu/gpu_py_shader.c
+++ b/source/blender/python/gpu/gpu_py_shader.c
@@ -211,8 +211,9 @@ static bool pygpu_shader_uniform_vector_impl(PyObject *args,
     return false;
   }
 
-  if (r_pybuffer->len != (*r_length * *r_count * elem_size)) {
-    PyErr_SetString(PyExc_BufferError, "GPUShader.uniform_vector_*: buffer size does not match.");
+  if (r_pybuffer->len < (*r_length * *r_count * elem_size)) {
+    PyErr_SetString(PyExc_OverflowError,
+                    "GPUShader.uniform_vector_*: buffer size smaller than required.");
     return false;
   }



More information about the Bf-blender-cvs mailing list