|
Jochen Schmitt |
9a904b4 |
@@ -, +, @@
|
|
Jochen Schmitt |
9a904b4 |
--enable-autoexec|-y|-666 (CVE-2009-3850)
|
|
Jochen Schmitt |
9a904b4 |
source/blender/blenkernel/intern/blender.c | 3 ++-
|
|
Jochen Schmitt |
9a904b4 |
source/blender/makesrna/intern/rna_userdef.c | 9 ++++++---
|
|
Jochen Schmitt |
9a904b4 |
source/blender/windowmanager/intern/wm_files.c | 3 ++-
|
|
Jochen Schmitt |
9a904b4 |
source/creator/creator.c | 10 ++++++----
|
|
Jochen Schmitt |
9a904b4 |
4 files changed, 16 insertions(+), 9 deletions(-)
|
|
Jochen Schmitt |
9a904b4 |
--- a/source/blender/blenkernel/intern/blender.c
|
|
Jochen Schmitt |
9a904b4 |
+++ a/source/blender/blenkernel/intern/blender.c
|
|
Jochen Schmitt |
9a904b4 |
@@ -141,7 +141,8 @@ void initglobals(void)
|
|
Jochen Schmitt |
9a904b4 |
G.charmin = 0x0000;
|
|
Jochen Schmitt |
9a904b4 |
G.charmax = 0xffff;
|
|
Jochen Schmitt |
9a904b4 |
|
|
Jochen Schmitt |
9a904b4 |
- G.f |= G_SCRIPT_AUTOEXEC;
|
|
Jochen Schmitt |
9a904b4 |
+ G.f &= ~G_SCRIPT_AUTOEXEC;
|
|
Jochen Schmitt |
9a904b4 |
+ G.f |= G_SCRIPT_OVERRIDE_PREF; /* Disables turning G_SCRIPT_AUTOEXEC on from user prefs */
|
|
Jochen Schmitt |
9a904b4 |
}
|
|
Jochen Schmitt |
9a904b4 |
|
|
Jochen Schmitt |
9a904b4 |
/***/
|
|
Jochen Schmitt |
9a904b4 |
--- a/source/blender/makesrna/intern/rna_userdef.c
|
|
Jochen Schmitt |
9a904b4 |
+++ a/source/blender/makesrna/intern/rna_userdef.c
|
|
Jochen Schmitt |
9a904b4 |
@@ -99,9 +99,12 @@ static void rna_userdef_show_manipulator_update(Main *bmain, Scene *scene, Point
|
|
Jochen Schmitt |
9a904b4 |
|
|
Jochen Schmitt |
9a904b4 |
static void rna_userdef_script_autoexec_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
|
Jochen Schmitt |
9a904b4 |
{
|
|
Jochen Schmitt |
9a904b4 |
- UserDef *userdef = (UserDef*)ptr->data;
|
|
Jochen Schmitt |
9a904b4 |
- if (userdef->flag & USER_SCRIPT_AUTOEXEC_DISABLE) G.f &= ~G_SCRIPT_AUTOEXEC;
|
|
Jochen Schmitt |
9a904b4 |
- else G.f |= G_SCRIPT_AUTOEXEC;
|
|
Jochen Schmitt |
9a904b4 |
+ if ((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) {
|
|
Jochen Schmitt |
9a904b4 |
+ /* Blender run with --enable-autoexec */
|
|
Jochen Schmitt |
9a904b4 |
+ UserDef *userdef = (UserDef*)ptr->data;
|
|
Jochen Schmitt |
9a904b4 |
+ if (userdef->flag & USER_SCRIPT_AUTOEXEC_DISABLE) G.f &= ~G_SCRIPT_AUTOEXEC;
|
|
Jochen Schmitt |
9a904b4 |
+ else G.f |= G_SCRIPT_AUTOEXEC;
|
|
Jochen Schmitt |
9a904b4 |
+ }
|
|
Jochen Schmitt |
9a904b4 |
}
|
|
Jochen Schmitt |
9a904b4 |
|
|
Jochen Schmitt |
9a904b4 |
static void rna_userdef_mipmap_update(Main *bmain, Scene *scene, PointerRNA *ptr)
|
|
Jochen Schmitt |
9a904b4 |
--- a/source/blender/windowmanager/intern/wm_files.c
|
|
Jochen Schmitt |
9a904b4 |
+++ a/source/blender/windowmanager/intern/wm_files.c
|
|
Jochen Schmitt |
9a904b4 |
@@ -270,7 +270,8 @@ static void wm_init_userdef(bContext *C)
|
|
Jochen Schmitt |
9a904b4 |
|
|
Jochen Schmitt |
9a904b4 |
/* set the python auto-execute setting from user prefs */
|
|
Jochen Schmitt |
9a904b4 |
/* enabled by default, unless explicitly enabled in the command line which overrides */
|
|
Jochen Schmitt |
9a904b4 |
- if((G.f & G_SCRIPT_OVERRIDE_PREF) == 0) {
|
|
Jochen Schmitt |
9a904b4 |
+ if (! G.background && ((G.f & G_SCRIPT_OVERRIDE_PREF) == 0)) {
|
|
Jochen Schmitt |
9a904b4 |
+ /* Blender run with --enable-autoexec */
|
|
Jochen Schmitt |
9a904b4 |
if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) G.f |= G_SCRIPT_AUTOEXEC;
|
|
Jochen Schmitt |
9a904b4 |
else G.f &= ~G_SCRIPT_AUTOEXEC;
|
|
Jochen Schmitt |
9a904b4 |
}
|
|
Jochen Schmitt |
9a904b4 |
--- a/source/creator/creator.c
|
|
Jochen Schmitt |
9a904b4 |
+++ a/source/creator/creator.c
|
|
Jochen Schmitt |
9a904b4 |
@@ -278,6 +278,7 @@ static int print_help(int UNUSED(argc), const char **UNUSED(argv), void *data)
|
|
Jochen Schmitt |
9a904b4 |
|
|
Jochen Schmitt |
9a904b4 |
printf("\n");
|
|
Jochen Schmitt |
9a904b4 |
|
|
Jochen Schmitt |
9a904b4 |
+ BLI_argsPrintArgDoc(ba, "-666");
|
|
Jochen Schmitt |
9a904b4 |
BLI_argsPrintArgDoc(ba, "--enable-autoexec");
|
|
Jochen Schmitt |
9a904b4 |
BLI_argsPrintArgDoc(ba, "--disable-autoexec");
|
|
Jochen Schmitt |
9a904b4 |
|
|
Jochen Schmitt |
9a904b4 |
@@ -359,14 +360,14 @@ static int end_arguments(int UNUSED(argc), const char **UNUSED(argv), void *UNUS
|
|
Jochen Schmitt |
9a904b4 |
static int enable_python(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
|
|
Jochen Schmitt |
9a904b4 |
{
|
|
Jochen Schmitt |
9a904b4 |
G.f |= G_SCRIPT_AUTOEXEC;
|
|
Jochen Schmitt |
9a904b4 |
- G.f |= G_SCRIPT_OVERRIDE_PREF;
|
|
Jochen Schmitt |
9a904b4 |
+ G.f &= ~G_SCRIPT_OVERRIDE_PREF; /* Enables turning G_SCRIPT_AUTOEXEC off from user prefs */
|
|
Jochen Schmitt |
9a904b4 |
return 0;
|
|
Jochen Schmitt |
9a904b4 |
}
|
|
Jochen Schmitt |
9a904b4 |
|
|
Jochen Schmitt |
9a904b4 |
static int disable_python(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
|
|
Jochen Schmitt |
9a904b4 |
{
|
|
Jochen Schmitt |
9a904b4 |
G.f &= ~G_SCRIPT_AUTOEXEC;
|
|
Jochen Schmitt |
9a904b4 |
- G.f |= G_SCRIPT_OVERRIDE_PREF;
|
|
Jochen Schmitt |
9a904b4 |
+ G.f |= G_SCRIPT_OVERRIDE_PREF; /* Disables turning G_SCRIPT_AUTOEXEC on from user prefs */
|
|
Jochen Schmitt |
9a904b4 |
return 0;
|
|
Jochen Schmitt |
9a904b4 |
}
|
|
Jochen Schmitt |
9a904b4 |
|
|
Jochen Schmitt |
9a904b4 |
@@ -1075,8 +1076,9 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
|
|
Jochen Schmitt |
9a904b4 |
|
|
Jochen Schmitt |
9a904b4 |
BLI_argsAdd(ba, 1, "-v", "--version", "\n\tPrint Blender version and exit", print_version, NULL);
|
|
Jochen Schmitt |
9a904b4 |
|
|
Jochen Schmitt |
9a904b4 |
- BLI_argsAdd(ba, 1, "-y", "--enable-autoexec", "\n\tEnable automatic python script execution (default)", enable_python, NULL);
|
|
Jochen Schmitt |
9a904b4 |
- BLI_argsAdd(ba, 1, "-Y", "--disable-autoexec", "\n\tDisable automatic python script execution (pydrivers, pyconstraints, pynodes)", disable_python, NULL);
|
|
Jochen Schmitt |
9a904b4 |
+ BLI_argsAdd(ba, 1, NULL, "-666", "\n\tEnable automatic python script execution (port from CVE-2009-3850 patch to Blender 2.49b)", enable_python, NULL);
|
|
Jochen Schmitt |
9a904b4 |
+ BLI_argsAdd(ba, 1, "-y", "--enable-autoexec", "\n\tEnable automatic python script execution", enable_python, NULL);
|
|
Jochen Schmitt |
9a904b4 |
+ BLI_argsAdd(ba, 1, "-Y", "--disable-autoexec", "\n\tDisable automatic python script execution (pydrivers, pyconstraints, pynodes) (default)", disable_python, NULL);
|
|
Jochen Schmitt |
9a904b4 |
|
|
Jochen Schmitt |
9a904b4 |
BLI_argsAdd(ba, 1, "-b", "--background", "<file>\n\tLoad <file> in background (often used for UI-less rendering)", background_mode, NULL);
|
|
Jochen Schmitt |
9a904b4 |
|