[Bf-committers] 50 ways to crash your blender
Holger Haase
bf-committers@blender.org
Tue, 20 May 2003 17:14:28 +0200
Hello all,
I played around with the sequencer, until blender crashed.
I searched the sources and found out, that the cause was something, that
might lead to crashes in other areas too.
The problem is, that StripElem.name[40] can only keep 39 characters, but is
supposed to store a filename.
There are three constants concerning lengths of file related stuff:
FILE_MAXDIR defined in util.c, BKE_utildefines.h, DNA_space_types.h
FILE_MAXFILE defined in " " "
MAXPATHLEN defined via MAX_PATH from windows.h in the windows world
and via sys/param.h in the other worlds.
Do we really need three constants? As directorynames and filenames can be
combined randomly, wouldn't it be enough to define MAXPATHLEN in a global
header file and use this constant everywhere where directory- and/or
filenames can be stored?
This global header file would be the ideal place to serve other
system-dependent constants as well, like the SEPARATOR for directory- and
filenames as a char and a string. I've already seen two places in the source
where entire blocks were duplified instead of using a constant... OK, one is
slightly different, but has the same function.
Perhaps anyone familiar with the naming scheme for the sources can put such
a file into the cvs? Otherwise I'll feed blender with a directoryname of 254
chars and a filename of 1 char, after that with a directoryname of 3 chars
and a filename of 252 chars and report every crash in the bug-tracker :-))
-
holger