summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2015-03-22 14:59:14 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2015-03-24 08:17:13 -0500
commite02b20a3d3a9241dbd34e127609639737e8ba7c9 (patch)
treefe02ec22893b9f064a4a051f73ea69b0f9bcf837 /cpukit
parentlibdl/rtl-shell.c: Adjust printf() format for off_t based on target (diff)
downloadrtems-e02b20a3d3a9241dbd34e127609639737e8ba7c9.tar.bz2
cpukit/libmisc/utf8proc/utf8proc.c: Avoid overflow
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/libmisc/utf8proc/utf8proc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cpukit/libmisc/utf8proc/utf8proc.c b/cpukit/libmisc/utf8proc/utf8proc.c
index 520760790c..19fd271eb9 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;
}