[PATCH 42/42] cpukit/libmisc/utf8proc/utf8proc.c: Avoid overflow

Joel Sherrill joel.sherrill at oarcorp.com
Mon Mar 23 14:39:40 UTC 2015


---
 cpukit/libmisc/utf8proc/utf8proc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/cpukit/libmisc/utf8proc/utf8proc.c b/cpukit/libmisc/utf8proc/utf8proc.c
index 5207607..19fd271 100644
--- a/cpukit/libmisc/utf8proc/utf8proc.c
+++ b/cpukit/libmisc/utf8proc/utf8proc.c
@@ -145,8 +145,13 @@ ssize_t utf8proc_iterate(
       (uc >= 0xFDD0 && uc < 0xFDF0)) uc = -1;
     break;
     case 4:
+#if defined(__rtems__)
+    uc = (((int32_t)str[0] & 0x07) << 18) + (((int32_t)str[1] & 0x3F) << 12)
+      + (((int32_t)str[2] & 0x3F) <<  6) + (str[3] & 0x3F);
+#else
     uc = ((str[0] & 0x07) << 18) + ((str[1] & 0x3F) << 12)
       + ((str[2] & 0x3F) <<  6) + (str[3] & 0x3F);
+#endif
     if (uc < 0x10000 || uc >= 0x110000) uc = -1;
     break;
   }
-- 
1.9.3



More information about the devel mailing list