Skip to content

Commit 0989f32

Browse files
authored
Merge pull request #3087 from pygame-community/ankith26-fix-set-comp-err
Fix component bounds checking
2 parents e5f62f5 + 42104e3 commit 0989f32

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src_c/math.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,6 +1199,10 @@ static PyMappingMethods vector_as_mapping = {
11991199
static int
12001200
vector_set_component(pgVector *self, PyObject *value, int component)
12011201
{
1202+
if (component >= self->dim) {
1203+
PyErr_BadInternalCall();
1204+
return -1;
1205+
}
12021206
if (value == NULL) {
12031207
switch (component) {
12041208
case 0: {

0 commit comments

Comments
 (0)