diff options
author | Alastair Poole <netstar@gmail.com> | 2018-08-16 10:12:35 -0400 |
---|---|---|
committer | Mike Blumenkrantz <zmike@samsung.com> | 2018-08-16 10:12:35 -0400 |
commit | 1bdda117a19f03d3ba86e6ee86b7a273a49aab56 (patch) | |
tree | 0958cb75fd3656250ee5d3f1ca5f26b0f486ffa6 | |
parent | e07b04f88c1f312889c688fd79102eddbabcf4fc (diff) | |
download | efl-1bdda117a19f03d3ba86e6ee86b7a273a49aab56.tar.gz |
elm_code_line: fix potential crash.
Summary:
This can occur and thus malloc will return NULL when line->length is
0. Check for !line->length and return. Very difficult to reproduce, but
I had managed three times, and avoided a crash.
Reviewers: #committers, ajwillia.ms, zmike
Reviewed By: #committers, zmike
Subscribers: cedric, #reviewers, zmike
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D6842
-rw-r--r-- | src/lib/elementary/elm_code_text.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/elementary/elm_code_text.c b/src/lib/elementary/elm_code_text.c index 1ebdb0999e..641dc41604 100644 --- a/src/lib/elementary/elm_code_text.c +++ b/src/lib/elementary/elm_code_text.c @@ -189,7 +189,7 @@ elm_code_line_text_remove(Elm_Code_Line *line, unsigned int position, int length Elm_Code_File *file; char *removed; - if (!line) + if (!line || !line->length) return; removed = malloc(sizeof(char) * line->length - length); |