Files
test2/tests
Thomas Barlow dc8e2c09d9 Fix #109024: Off-by-1 in rna_access for non-array props without raw access
The `a + array_len > in.len` check was off-by-1 whenever accessing a
non-array property without raw access. This was because `array_len` was
actually the array length of the property, which is `0` for non-array
properties.

Given an array which was too short, this would cause the slower loop to
overrun the end of the array by one item. When getting items this would
cause a crash on a debug build with `Fatal Python error:
_PyMem_DebugRawFree: bad trailing pad byte`.

So use `item_len` instead, wichi is always set to `1` for non-array
properties.

Also do not assume that an `array_len` of `0` means that the property is
an array. While this may be true currently, it is cleaner and safer to
use the dedicated RNA API to check that.

This PR also adds some basic checks for expected failure of `foreach_set`
/`foreach_get` API when the provided array is too small.

Co-authored-by: Bastien Montagne <bastien@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/115967
2025-06-18 11:03:27 +02:00
..