[rtems commit] cpukit/libmisc/utf8proc/utf8proc.c: Avoid overflow
Joel Sherril
joel at rtems.org
Tue Mar 24 13:18:11 UTC 2015
Module: rtems
Branch: master
Commit: e02b20a3d3a9241dbd34e127609639737e8ba7c9
Changeset: http://git.rtems.org/rtems/commit/?id=e02b20a3d3a9241dbd34e127609639737e8ba7c9
Author: Joel Sherrill <joel.sherrill at oarcorp.com>
Date: Sun Mar 22 14:59:14 2015 -0500
cpukit/libmisc/utf8proc/utf8proc.c: Avoid overflow
---
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;
}
More information about the vc
mailing list