[Bf-blender-cvs] [ef40b0f1360] temp-gpu-image-engine: Fix possible use-after-free on error handling during VR view drawing

Julian Eisel noreply at git.blender.org
Wed Dec 15 14:37:52 CET 2021


Commit: ef40b0f1360f85f1b6840be0b5a92f49911240ed
Author: Julian Eisel
Date:   Tue Dec 14 20:57:39 2021 +0100
Branches: temp-gpu-image-engine
https://developer.blender.org/rBef40b0f1360f85f1b6840be0b5a92f49911240ed

Fix possible use-after-free on error handling during VR view drawing

Whenever an exception happens in VR session code, we cancel the entire
session. Alongside that, we removed the "surface" item used to draw into
an offscreen context. This would mess up the iterator of the surface
draw loop.
Similar to 7afd84df409a.

===================================================================

M	source/blender/windowmanager/intern/wm_surface.c

===================================================================

diff --git a/source/blender/windowmanager/intern/wm_surface.c b/source/blender/windowmanager/intern/wm_surface.c
index 39bff205cbd..385b55f36f9 100644
--- a/source/blender/windowmanager/intern/wm_surface.c
+++ b/source/blender/windowmanager/intern/wm_surface.c
@@ -45,7 +45,8 @@ static wmSurface *g_drawable = NULL;
 
 void wm_surfaces_iter(bContext *C, void (*cb)(bContext *C, wmSurface *))
 {
-  LISTBASE_FOREACH (wmSurface *, surf, &global_surface_list) {
+  /* Mutable iterator in case a surface is freed. */
+  LISTBASE_FOREACH_MUTABLE (wmSurface *, surf, &global_surface_list) {
     cb(C, surf);
   }
 }



More information about the Bf-blender-cvs mailing list