Page MenuHomePhabricator

textblock: Fix crash with filters
ClosedPublic

Authored by jpeg on Nov 27 2018, 2:10 AM.

Details

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</>"

Diff Detail

Repository
rEFL core/efl
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
jpeg created this revision.Nov 27 2018, 2:10 AM

It seems that this patch has no reviewers specified. If you are unsure who can review your patch, please check this wiki page and see if anyone can be added: https://phab.enlightenment.org/w/maintainers_reviewers/

jpeg requested review of this revision.Nov 27 2018, 2:10 AM

Cannot reproduce the problem with this code:

_editor = efl_add(EFL_UI_TEXT_CLASS, box);
efl_text_markup_set(_editor, "<gfx_filter='code'>Hello</>");
efl_pack(box, _editor);

It keeps spewing this line on the console, but no crash:

WRN<60318>: lib/evas/canvas/evas_object_textblock.c:14100 evas_object_textblock_render() Filter 'code' not found on this object
zmike accepted this revision.Jan 9 2019, 9:14 AM
zmike added a subscriber: zmike.

Adding null checks is the accepted practice for solving issues in efl.

This revision is now accepted and ready to land.Jan 9 2019, 9:14 AM
This revision was automatically updated to reflect the committed changes.