Skip to content

Commit 418f1a0

Browse files
Check variable array size when setting variable values and raise IndexError, as
is already done for getting variable values.
1 parent 8e71486 commit 418f1a0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Variable.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,13 @@ static int Variable_SetSingleValue(udt_Variable *var, uint32_t arrayPos,
782782
int result = 0;
783783
dpiData *data;
784784

785+
// ensure we do not exceed the number of allocated elements
786+
if (arrayPos >= var->allocatedElements) {
787+
PyErr_SetString(PyExc_IndexError,
788+
"Variable_SetSingleValue: array size exceeded");
789+
return -1;
790+
}
791+
785792
// convert value, if necessary
786793
if (var->inConverter && var->inConverter != Py_None) {
787794
convertedValue = PyObject_CallFunctionObjArgs(var->inConverter, value,

0 commit comments

Comments
 (0)