Hi Raster,

I've changed evas_common_font_utf8_get_next() so that it is a little more
robust against invalid UTF-8 input.
In case of invalid UTF-8, this version avoids reading non-allocated memory
in most instances.

Cheers,
Bernhard

--- src/lib/engines/common/evas_font_main.c.orig        2004-07-16
11:06:50.000000000 +0200
+++ src/lib/engines/common/evas_font_main.c     2004-07-16
11:07:37.000000000 +0200
@@ -125,10 +125,8 @@
    else if ((d & 0xf0) == 0xe0) 
      { 
        /* 3 byte */
-       d2 = buf[index++];
-       d3 = buf[index++];
-       if ((d2 & 0xc0) != 0x80 ||
-           (d3 & 0xc0) != 0x80)
+       if (((d2 = buf[index++]) & 0xc0) != 0x80 ||
+           ((d3 = buf[index++]) & 0xc0) != 0x80)
          return 0;
        r = d & 0x0f; /* copy lower 4 */
        r <<= 6;
@@ -139,12 +137,9 @@
    else
      { 
        /* 4 byte */
-       d2 = buf[index++];
-       d3 = buf[index++];
-       d4 = buf[index++];
-       if ((d2 & 0xc0) != 0x80 ||
-           (d3 & 0xc0) != 0x80 ||
-           (d4 & 0xc0) != 0x80)
+       if (((d2 = buf[index++]) & 0xc0) != 0x80 ||
+           ((d3 = buf[index++]) & 0xc0) != 0x80 ||
+           ((d4 = buf[index++]) & 0xc0) != 0x80)
          return 0;
        r = d & 0x0f; /* copy lower 4 */
        r <<= 6;




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
enlightenment-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to