tasn pushed a commit to branch master.
commit 23264ae09cf6b0bfc09c3858df0cfc3539766c88
Author: Tom Hacohen <[email protected]>
Date: Mon Mar 11 15:18:21 2013 +0000
Evas textblock: Fixed coord (int) overflow.
X advance coords can be bigger than the limits of short.
---
src/lib/evas/common/evas_text_utils.h | 3 ++-
src/tests/evas/evas_test_textblock.c | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/src/lib/evas/common/evas_text_utils.h
b/src/lib/evas/common/evas_text_utils.h
index 144761e..c24ded6 100644
--- a/src/lib/evas/common/evas_text_utils.h
+++ b/src/lib/evas/common/evas_text_utils.h
@@ -123,7 +123,8 @@ struct _Evas_Font_Glyph_Info
#if 1
// done with shorts to save space... if we need 32k or bigger glyphs and
// relative layout info... worry then.
- short x_bear, y_bear, width, pen_after; // 8
+ Evas_Coord pen_after; // 4
+ short x_bear, y_bear, width; // 6
#else
Evas_Coord x_bear; // 4
/* This one is rarely used, only in draw, in which we already get the glyph
diff --git a/src/tests/evas/evas_test_textblock.c
b/src/tests/evas/evas_test_textblock.c
index 20b31e8..117ea15 100644
--- a/src/tests/evas/evas_test_textblock.c
+++ b/src/tests/evas/evas_test_textblock.c
@@ -1353,6 +1353,40 @@ START_TEST(evas_textblock_various)
evas_textblock_cursor_pos_set(cur, 0);
evas_textblock_cursor_char_delete(cur);
+ /* Super big one line item. */
+ {
+#define CNT 10000
+ char str[(CNT * 6) + 128], *d;
+ const char substr[] = "x";
+ Evas_Textblock_Style *stt;
+ int i, l;
+
+ l = strlen(substr);
+ d = str;
+ for (i = 0; i < CNT; i++)
+ {
+ memcpy(d, substr, l);
+ d += l;
+ }
+ *d = 0;
+
+ stt = evas_textblock_style_new();
+ evas_textblock_style_set(stt,
+ "DEFAULT='font=" TEST_FONT " font_size=10 align=left
color=#000000 wrap=char'");
+ evas_object_textblock_style_set(tb, stt);
+ evas_textblock_style_free(stt);
+
+ evas_object_textblock_text_markup_set(tb, substr);
+ Evas_Textblock_Cursor *cr;
+
+ cr = evas_object_textblock_cursor_get(tb);
+ evas_textblock_cursor_text_append(cr, str);
+ evas_object_resize(tb, 480, 800);
+
+ evas_object_textblock_size_formatted_get(tb, &w, &h);
+ fail_if(w == 0);
+ }
+
END_TB_TEST();
}
END_TEST
--
------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
endpoint security space. For insight on selecting the right partner to
tackle endpoint security challenges, access the full report.
http://p.sf.net/sfu/symantec-dev2dev