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
This commit is contained in:
Alastair Poole 2018-08-16 10:12:35 -04:00 committed by Mike Blumenkrantz
parent e07b04f88c
commit 1bdda117a1
1 changed files with 1 additions and 1 deletions

View File

@ -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);