From 6f15383b2c30e19d23cb49da67bd59dfd9ea3591 Mon Sep 17 00:00:00 2001 From: aliaspider Date: Thu, 2 Oct 2014 21:02:27 +0100 Subject: [PATCH] initialize frame_cache and texture_frame to a dummy frame in init_video_input() to avoid undefined behavior in the init phase in case they are used before being set. --- driver.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/driver.c b/driver.c index b72b851694..c231d0d95e 100644 --- a/driver.c +++ b/driver.c @@ -1349,6 +1349,7 @@ void init_video_input(void) const input_driver_t *tmp = NULL; const struct retro_game_geometry *geom = NULL; video_info_t video = {0}; + static int dummy_pixel=0; rarch_init_filter(g_extern.system.pix_fmt); rarch_init_shader_dir(); @@ -1516,6 +1517,16 @@ void init_video_input(void) rarch_main_command(RARCH_CMD_OVERLAY_INIT); g_extern.measure_data.frame_time_samples_count = 0; + + g_extern.frame_cache.width = 1; + g_extern.frame_cache.height = 1; + g_extern.frame_cache.pitch = 4; + g_extern.frame_cache.data = &dummy_pixel; + + if (driver.video_poke && driver.video_poke->set_texture_frame) + driver.video_poke->set_texture_frame(driver.video_data, + &dummy_pixel, false, 1, 1, 1.0f); + } void uninit_video_input(void)