Fix T78823: Slash in custom property name does not work

Some characters: `'`, `"`, and `\`, can cause problems with RNA paths.
Instead of using more complicated handling to deal with those cases,
we can just prevent these characters from being used in custom property
names.

This commit checks for these characters to `idp_try_read_name`, where
other checks like length are already done.

Differential Revision: https://developer.blender.org/D8839
This commit is contained in:
Hans Goudey 2020-09-22 08:48:39 -05:00
parent 626201683e
commit cbae82ba96
Notes: blender-bot 2023-02-14 03:29:37 +01:00
Referenced by commit d1cedf53fa, Revert "Fix T78823: Slash in custom property name does not work"
Referenced by issue #84091, Crash when going to Properties Editor object properties with Custom Property containing nested dictionary [named "asset_data"]
Referenced by issue #78823, Slash in custom property name does not work
1 changed files with 7 additions and 0 deletions

View File

@ -20,6 +20,8 @@
#include <Python.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "BLI_utildefines.h"
@ -370,6 +372,11 @@ static const char *idp_try_read_name(PyObject *name_obj)
"the length of IDProperty names is limited to 63 characters");
return NULL;
}
if (strchr(name, '\"') || strchr(name, '\\') || strchr(name, '\'')) {
PyErr_SetString(PyExc_KeyError, "IDProperty names cannot include \", \\, or \'");
return NULL;
}
}
else {
name = "";