[Bf-blender-cvs] [c1c0473a7ef] blender-v3.3-release: Fix out of bounds read in LineArt if there are only interestion edges

Sebastian Parborg noreply at git.blender.org
Fri Aug 12 17:56:41 CEST 2022


Commit: c1c0473a7efb5dc6455401799e3f3e8282aa31df
Author: Sebastian Parborg
Date:   Fri Aug 12 17:52:15 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rBc1c0473a7efb5dc6455401799e3f3e8282aa31df

Fix out of bounds read in LineArt if there are only interestion edges

In this case the array allocation would allocate an array of size zero.
This would then later lead to out of bounds memory reads.

Now the code will skip zero length allocations.

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

M	source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c

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

diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
index 9970e4d5ac1..a6b9f1420f1 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
+++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c
@@ -1799,7 +1799,7 @@ static void lineart_add_edge_to_array_thread(LineartObjectInfo *obi, LineartEdge
  * #pe.  */
 void lineart_finalize_object_edge_array_reserve(LineartPendingEdges *pe, int count)
 {
-  if (pe->max || pe->array) {
+  if (pe->max || pe->array || count == 0) {
     return;
   }



More information about the Bf-blender-cvs mailing list