From e23bcbbb6d78709993b6187a2631eb20cd555e5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20T=C3=B6nne?= Date: Tue, 7 Jan 2014 14:51:59 +0100 Subject: [PATCH] Fix for crash in anim render: The callbacks in bMovieHandle are expected to exist and accessed without prior NULL checks (with exception of get_next_frame and get_movie_path). The callbacks are not reliably initialized however if none of the video formats is enabled (AVI being the default). Added stub functions now that ensure access to bMovieHandle callbacks is safe and doesn't crash. --- source/blender/blenkernel/intern/writeavi.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/writeavi.c b/source/blender/blenkernel/intern/writeavi.c index 1d29ef70d8b..40bb593c108 100644 --- a/source/blender/blenkernel/intern/writeavi.c +++ b/source/blender/blenkernel/intern/writeavi.c @@ -50,6 +50,17 @@ /* ********************** general blender movie support ***************************** */ +static int start_stub(Scene *UNUSED(scene), RenderData *UNUSED(rd), int UNUSED(rectx), int UNUSED(recty), + ReportList *UNUSED(reports)) +{ return 0; } + +static void end_stub(void) +{} + +static int append_stub(RenderData *UNUSED(rd), int UNUSED(start_frame), int UNUSED(frame), int *UNUSED(pixels), + int UNUSED(rectx), int UNUSED(recty), ReportList *UNUSED(reports)) +{ return 0; } + #ifdef WITH_AVI # include "AVI_avi.h" @@ -74,13 +85,18 @@ static void filepath_avi(char *string, RenderData *rd); bMovieHandle *BKE_movie_handle_get(const char imtype) { static bMovieHandle mh = {NULL}; + /* stub callbacks in case none of the movie formats is supported */ + mh.start_movie = start_stub; + mh.append_movie = append_stub; + mh.end_movie = end_stub; + mh.get_next_frame = NULL; + mh.get_movie_path = NULL; /* set the default handle, as builtin */ #ifdef WITH_AVI mh.start_movie = start_avi; mh.append_movie = append_avi; mh.end_movie = end_avi; - mh.get_next_frame = NULL; mh.get_movie_path = filepath_avi; #endif