evas filters: Fix a rare crash in text render (SW)

There are reports of crashes when y < 0. This case seems
abnormal in case of filters, as I don't know how to reproduce it,
but it's happened.

Thanks Youngbok Shin for the report.

@fix
This commit is contained in:
Jean-Philippe Andre 2017-04-10 16:56:14 +09:00
parent c0db1f4225
commit f3c9500a6d
1 changed files with 15 additions and 2 deletions

View File

@ -508,11 +508,24 @@ evas_common_font_glyph_draw(RGBA_Font_Glyph *fg,
// FIXME: Font draw not optimized for Alpha targets! SLOW!
// This is not pretty :)
DATA8 *dst8 = dst_image->image.data8 + x + (y * dst_pitch);
Alpha_Gfx_Func func;
DATA8 *src8;
DATA8 *src8, *dst8;
int row;
if (EINA_UNLIKELY(x < 0))
{
x1 += (-x);
x = 0;
if ((x2 - x1) <= 0) return;
}
if (EINA_UNLIKELY(y < 0))
{
y1 += (-y);
y = 0;
if ((y2 - y1) <= 0) return;
}
dst8 = dst_image->image.data8 + x + (y * dst_pitch);
func = efl_draw_alpha_func_get(dc->render_op, EINA_FALSE);
src8 = evas_common_font_glyph_uncompress(fg, NULL, NULL);
if (!src8) return;