Zebediah Figura : d3dcompiler: Iterate through the instruction list in reverse in free_instr_list() (Valgrind).

Alexandre Julliard julliard at winehq.org
Mon Aug 10 16:16:30 CDT 2020


Module: wine
Branch: master
Commit: 23cc3003722317b72bd798a00678f24c36937762
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=23cc3003722317b72bd798a00678f24c36937762

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Aug 10 11:11:35 2020 -0500

d3dcompiler: Iterate through the instruction list in reverse in free_instr_list() (Valgrind).

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3dcompiler_43/utils.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c
index 336bf0d9bc..df39716b49 100644
--- a/dlls/d3dcompiler_43/utils.c
+++ b/dlls/d3dcompiler_43/utils.c
@@ -2113,7 +2113,9 @@ void free_instr_list(struct list *list)
 
     if (!list)
         return;
-    LIST_FOR_EACH_ENTRY_SAFE(node, next_node, list, struct hlsl_ir_node, entry)
+    /* Iterate in reverse, to avoid use-after-free when unlinking sources from
+     * the "uses" list. */
+    LIST_FOR_EACH_ENTRY_SAFE_REV(node, next_node, list, struct hlsl_ir_node, entry)
         free_instr(node);
     d3dcompiler_free(list);
 }




More information about the wine-cvs mailing list