[Bf-committers] Security Fix

Philipp Gühring blender at futureware.at
Sat Sep 25 21:08:08 CEST 2004


Hi,

We are building a renderfarm, and came across a lot of problematic 
picture-filenames:

Under Unix:
/render/abc
( The directory /render does not exist, so the image is lost)
Unter Windows
C:\ntldr
( this would crash the whole machine)

So we created the following patch for blender, to solve the problem.
With this patch you can override the output filename like this:

blender -o newfilename -b anim.blender -a

Here is the patch:

Many greetings,
Philipp Gühring

--- source/creator/creator.c.orig       2004-08-02 00:28:56.000000000 +0200
+++ source/creator/creator.c    2004-09-25 20:53:41.687558760 +0200
@@ -99,6 +99,9 @@
 # include <sys/rtprio.h>
 #endif

+// for overriding the outputfilename for backgroundrendering
+char *outputfilename=NULL;
+
 // from buildinfo.c
 extern char * build_date;
 extern char * build_time;
@@ -166,6 +169,7 @@
        printf ("    -s <frame>\tSet start to frame <frame> (use with -a)\n");
        printf ("    -e <frame>\tSet end to frame (use with -a)<frame>\n");
        printf ("    -a\t\tRender animation\n");
+       printf ("    -o <filename>\tSet filename for output\n");

        printf ("\nAnimation options:\n");
        printf ("  -a <file(s)>\tPlayback <file(s)>\n");
@@ -308,6 +312,10 @@
                                G.background = 1;
                                a= argc;
                                break;
+                       case 'o':
+                       case 'O':
+                               outputfilename=argv[++a];
+                               break;

          case 'm':
              /* unified render pipeline */
--- source/blender/render/intern/source/initrender.c.orig       2004-07-12 
05:20:30.000000000 +0200
+++ source/blender/render/intern/source/initrender.c    2004-09-25 
20:55:07.372532664 +0200
@@ -118,6 +118,8 @@
 short allparts[65][4];
 int qscount;

+extern char *outputfilename;
+
 /* ********************* *********************** */


@@ -1277,6 +1279,7 @@
                        } else if ELEM4(R.r.imtype, R_AVIRAW, R_AVIJPEG, 
R_MOVIE, R_AVICODEC) {
                                append_avi((G.scene->r.cfra));
                        } else {
+                               if(outputfilename!=NULL && 
strlen(outputfilename)<159) strcpy(G.scene->r.pic,outputfilename);
                                makepicstring(name, (G.scene->r.cfra));
                                schrijfplaatje(name);
                                if(RE_local_test_break()==0) printf("Saved: 
%s", name);



More information about the Bf-committers mailing list