zmike pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=6539bc7788f71d1265c9242f51400b4f713752ce

commit 6539bc7788f71d1265c9242f51400b4f713752ce
Author: Jean-Philippe André <j...@videolan.org>
Date:   Wed Jan 9 12:46:38 2019 -0500

    textblock: Fix crash with filters
    
    Summary:
    A crash could happen on a bad call to free() context_dup() returns a
    newly malloc'ed context if passed NULL (this seems dubious to me, why
    not calloc?).
    
    @fix
    
    Test Plan:
      Add an empty efl.ui.text object
      Set markup text as "<gfx_filter='code'>Hello</>"
    
    Reviewers: cedric, segfaultxavi, Jaehyun, herdsman, zmike
    
    Reviewed By: zmike
    
    Subscribers: zmike, cedric, #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D7368
---
 src/lib/evas/canvas/evas_object_textblock.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/lib/evas/canvas/evas_object_textblock.c 
b/src/lib/evas/canvas/evas_object_textblock.c
index 339d153f83..b33cb6f5eb 100644
--- a/src/lib/evas/canvas/evas_object_textblock.c
+++ b/src/lib/evas/canvas/evas_object_textblock.c
@@ -2842,7 +2842,8 @@ _format_dup(Evas_Object *eo_obj, const 
Evas_Object_Textblock_Format *fmt)
         fmt2->gfx_filter = malloc(sizeof(*fmt2->gfx_filter));
         memcpy(fmt2->gfx_filter, fmt->gfx_filter, sizeof(*fmt->gfx_filter));
         fmt2->gfx_filter->name = eina_stringshare_ref(fmt->gfx_filter->name);
-        fmt2->gfx_filter->dc = ENFN->context_dup(ENC, fmt->gfx_filter->dc);
+        if (fmt->gfx_filter->dc)
+          fmt2->gfx_filter->dc = ENFN->context_dup(ENC, fmt->gfx_filter->dc);
      }
 
    return fmt2;

-- 


Reply via email to