[Bf-blender-cvs] [aa1e8bb9ab9] master: Fix T97150: Export GPencil to PDF or SVG crashes blender

Antonio Vazquez noreply at git.blender.org
Fri Apr 8 12:18:34 CEST 2022


Commit: aa1e8bb9ab925a436fd832bdb958bef8dbcf3164
Author: Antonio Vazquez
Date:   Fri Apr 8 12:18:15 2022 +0200
Branches: master
https://developer.blender.org/rBaa1e8bb9ab925a436fd832bdb958bef8dbcf3164

Fix T97150: Export GPencil to PDF or SVG crashes blender

The problem was the original file had some vertex  weight information, but the weights array was empty, so the duplication was not done and the free memory crashed.

To avoid this type of errors, now before duplicate weights the function checks the pointer and also the number of weights elements in the array to avoid the duplicatiopn of empty data.

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

M	source/blender/blenkernel/intern/gpencil.c

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 92ed273cac8..087d8b8fcd4 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -867,7 +867,7 @@ bGPDstroke *BKE_gpencil_stroke_duplicate(bGPDstroke *gps_src,
   if (dup_points) {
     gps_dst->points = MEM_dupallocN(gps_src->points);
 
-    if (gps_src->dvert != NULL) {
+    if ((gps_src->dvert != NULL) && (gps_src->dvert->totweight > 0)) {
       gps_dst->dvert = MEM_dupallocN(gps_src->dvert);
       BKE_gpencil_stroke_weights_duplicate(gps_src, gps_dst);
     }



More information about the Bf-blender-cvs mailing list