From cebaedd7094b547bc426c9a8acc83c950119441d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 16 Oct 2015 04:31:17 +1100 Subject: Fix crash w/ PlayAnim & long filenames Paths >128 chars could crash. Replace BLI_newname with direct BLI_stringenc/dec use which makes more sense in this case. --- source/blender/windowmanager/intern/wm_playanim.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c index 31690f8a6ae..2150d94d9b0 100644 --- a/source/blender/windowmanager/intern/wm_playanim.c +++ b/source/blender/windowmanager/intern/wm_playanim.c @@ -412,7 +412,14 @@ static void build_pict_list_ex(PlayState *ps, const char *first, int totframes, else { int count = 0; + int fp_framenr; + struct { + char head[FILE_MAX], tail[FILE_MAX]; + unsigned short digits; + } fp_decoded; + BLI_strncpy(filepath, first, sizeof(filepath)); + fp_framenr = BLI_stringdec(filepath, fp_decoded.head, fp_decoded.tail, &fp_decoded.digits); pupdate_time(); ptottime = 1.0; @@ -503,7 +510,9 @@ static void build_pict_list_ex(PlayState *ps, const char *first, int totframes, ptottime = 0.0; } - BLI_newname(filepath, +fstep); + /* create a new filepath each time */ + fp_framenr += fstep; + BLI_stringenc(filepath, fp_decoded.head, fp_decoded.tail, fp_decoded.digits, fp_framenr); while ((hasevent = GHOST_ProcessEvents(g_WS.ghost_system, 0))) { if (hasevent) { -- cgit v1.2.3