Revision: 25515 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25515 Author: campbellbarton Date: 2009-12-22 11:04:15 +0100 (Tue, 22 Dec 2009)
Log Message: ----------- quite a few python panels (10 or so) had names longer then the PanelType allowed, for panels it would fail silently but for menu's it meant further references would give errors. increase the registered class name from 32 to 64 and raise an error if the limit reached. Modified Paths: -------------- trunk/blender/source/blender/blenkernel/BKE_screen.h trunk/blender/source/blender/makesrna/intern/rna_ID.c trunk/blender/source/blender/makesrna/intern/rna_render.c trunk/blender/source/blender/makesrna/intern/rna_ui.c trunk/blender/source/blender/render/extern/include/RE_pipeline.h Modified: trunk/blender/source/blender/blenkernel/BKE_screen.h =================================================================== --- trunk/blender/source/blender/blenkernel/BKE_screen.h 2009-12-22 09:46:03 UTC (rev 25514) +++ trunk/blender/source/blender/blenkernel/BKE_screen.h 2009-12-22 10:04:15 UTC (rev 25515) @@ -55,7 +55,7 @@ ED_spacetypes_init() in editors/area/spacetypes.c */ /* an editor in Blender is a combined ScrArea + SpaceType + SpaceData */ -#define BKE_ST_MAXNAME 32 +#define BKE_ST_MAXNAME 64 typedef struct SpaceType { struct SpaceType *next, *prev; Modified: trunk/blender/source/blender/makesrna/intern/rna_ID.c =================================================================== --- trunk/blender/source/blender/makesrna/intern/rna_ID.c 2009-12-22 09:46:03 UTC (rev 25514) +++ trunk/blender/source/blender/makesrna/intern/rna_ID.c 2009-12-22 10:04:15 UTC (rev 25515) @@ -205,6 +205,15 @@ if(validate(&dummyptr, data, NULL) != 0) return NULL; + /* note: it looks like there is no length limit on the srna id since its + * just a char pointer, but take care here, also be careful that python + * owns the string pointer which it could potentually free while blender + * is running. */ + if(strlen(identifier) >= sizeof(((IDProperty *)NULL)->name)) { + BKE_reportf(reports, RPT_ERROR, "registering id property class: '%s' is too long, maximum length is %d.", identifier, sizeof(((IDProperty *)NULL)->name)); + return NULL; + } + return RNA_def_struct(&BLENDER_RNA, identifier, "IDPropertyGroup"); // XXX } Modified: trunk/blender/source/blender/makesrna/intern/rna_render.c =================================================================== --- trunk/blender/source/blender/makesrna/intern/rna_render.c 2009-12-22 09:46:03 UTC (rev 25514) +++ trunk/blender/source/blender/makesrna/intern/rna_render.c 2009-12-22 10:04:15 UTC (rev 25515) @@ -125,7 +125,12 @@ /* validate the python class */ if(validate(&dummyptr, data, have_function) != 0) return NULL; - + + if(strlen(identifier) >= sizeof(dummyet.idname)) { + BKE_reportf(reports, RPT_ERROR, "registering render engine class: '%s' is too long, maximum length is %d.", identifier, sizeof(dummyet.idname)); + return NULL; + } + /* check if we have registered this engine type before, and remove it */ for(et=R_engines.first; et; et=et->next) { if(strcmp(et->idname, dummyet.idname) == 0) { Modified: trunk/blender/source/blender/makesrna/intern/rna_ui.c =================================================================== --- trunk/blender/source/blender/makesrna/intern/rna_ui.c 2009-12-22 09:46:03 UTC (rev 25514) +++ trunk/blender/source/blender/makesrna/intern/rna_ui.c 2009-12-22 10:04:15 UTC (rev 25515) @@ -163,6 +163,11 @@ /* validate the python class */ if(validate(&dummyptr, data, have_function) != 0) return NULL; + + if(strlen(identifier) >= sizeof(dummypt.idname)) { + BKE_reportf(reports, RPT_ERROR, "registering panel class: '%s' is too long, maximum length is %d.", identifier, sizeof(dummypt.idname)); + return NULL; + } if(!(art=region_type_find(reports, dummypt.space_type, dummypt.region_type))) return NULL; @@ -260,7 +265,12 @@ /* validate the python class */ if(validate(&dummyhtr, data, have_function) != 0) return NULL; - + + if(strlen(identifier) >= sizeof(dummyht.idname)) { + BKE_reportf(reports, RPT_ERROR, "registering header class: '%s' is too long, maximum length is %d.", identifier, sizeof(dummyht.idname)); + return NULL; + } + if(!(art=region_type_find(reports, dummyht.space_type, RGN_TYPE_HEADER))) return NULL; @@ -373,6 +383,11 @@ /* validate the python class */ if(validate(&dummymtr, data, have_function) != 0) return NULL; + + if(strlen(identifier) >= sizeof(dummymt.idname)) { + BKE_reportf(reports, RPT_ERROR, "registering menu class: '%s' is too long, maximum length is %d.", identifier, sizeof(dummymt.idname)); + return NULL; + } /* check if we have registered this menu type before, and remove it */ mt= WM_menutype_find(dummymt.idname, TRUE); Modified: trunk/blender/source/blender/render/extern/include/RE_pipeline.h =================================================================== --- trunk/blender/source/blender/render/extern/include/RE_pipeline.h 2009-12-22 09:46:03 UTC (rev 25514) +++ trunk/blender/source/blender/render/extern/include/RE_pipeline.h 2009-12-22 10:04:15 UTC (rev 25515) @@ -253,8 +253,8 @@ struct RenderEngineType *next, *prev; /* type info */ - char idname[32]; - char name[32]; + char idname[64]; // best keep the same size as BKE_ST_MAXNAME + char name[64]; int flag; void (*render)(struct RenderEngine *engine, struct Scene *scene); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs