From f3c9500a6d7de03f92b62cf6515518dbe6385259 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Mon, 10 Apr 2017 16:56:14 +0900 Subject: 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 --- src/lib/evas/common/evas_font_compress.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/lib/evas/common') diff --git a/src/lib/evas/common/evas_font_compress.c b/src/lib/evas/common/evas_font_compress.c index 7788ba52ea..e923e17251 100644 --- a/src/lib/evas/common/evas_font_compress.c +++ b/src/lib/evas/common/evas_font_compress.c @@ -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; -- cgit v1.2.1