summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2005-04-13 19:26:07 (GMT)
committer James Bursa <james@netsurf-browser.org>2005-04-13 19:26:07 (GMT)
commitfef981f68c4cdd6541daae3a7b5422e9bb33ee7f (patch)
treec6ba19e9d2c3db85100fd9fc284d5ad85a92aa2a
parenta9768c64b5df87af089e14401924b313ea2b0e72 (diff)
downloadlibrufl-fef981f68c4cdd6541daae3a7b5422e9bb33ee7f.tar.gz
librufl-fef981f68c4cdd6541daae3a7b5422e9bb33ee7f.tar.bz2
[project @ 2005-04-13 19:26:07 by bursa]
Fix crash with characters 0x10000 or greater. svn path=/import/rufl/; revision=2461
-rw-r--r--rufl_character_set_test.c2
-rw-r--r--rufl_paint.c8
-rw-r--r--rufl_test.c4
3 files changed, 9 insertions, 5 deletions
diff --git a/rufl_character_set_test.c b/rufl_character_set_test.c
index 47f5743..45fbcaf 100644
--- a/rufl_character_set_test.c
+++ b/rufl_character_set_test.c
@@ -23,7 +23,7 @@ bool rufl_character_set_test(struct rufl_character_set *charset,
unsigned int byte = (c >> 3) & 31;
unsigned int bit = c & 7;
- if (256 < block)
+ if (256 <= block)
return false;
if (charset->index[block] == BLOCK_EMPTY)
diff --git a/rufl_paint.c b/rufl_paint.c
index adfcb4a..f6cdefc 100644
--- a/rufl_paint.c
+++ b/rufl_paint.c
@@ -196,8 +196,10 @@ rufl_code rufl_process(rufl_action action,
rufl_utf8_read(string, length, u);
if (charset && rufl_character_set_test(charset, u))
font1 = font;
- else
+ else if (u < 0x10000)
font1 = rufl_substitution_table[u];
+ else
+ font1 = NOT_AVAILABLE;
do {
s[0] = u;
offset_map[0] = offset_u;
@@ -211,8 +213,10 @@ rufl_code rufl_process(rufl_action action,
offset_map[n] = offset_u;
if (charset && rufl_character_set_test(charset, u))
font1 = font;
- else
+ else if (u < 0x10000)
font1 = rufl_substitution_table[u];
+ else
+ font1 = NOT_AVAILABLE;
if (font1 == font0)
n++;
}
diff --git a/rufl_test.c b/rufl_test.c
index 68148ea..b9a4319 100644
--- a/rufl_test.c
+++ b/rufl_test.c
@@ -17,7 +17,7 @@ static void try(rufl_code code, const char *context);
int main(void)
{
char utf8_test[] = "Hello, world! ὕαλον "
- "Uherské Hradiště.";
+ "Uherské Hradiště. 𐀀";
int width;
size_t char_offset;
int x;
@@ -27,7 +27,7 @@ int main(void)
rufl_dump_state();
try(rufl_paint("NewHall", rufl_REGULAR, 240,
utf8_test, sizeof utf8_test - 1,
- 1200, 1200, 0), "rufl_paint");
+ 1200, 1000, 0), "rufl_paint");
try(rufl_width("NewHall", rufl_REGULAR, 240,
utf8_test, sizeof utf8_test - 1,
&width), "rufl_width");