Index: common/str.c
===================================================================
--- common/str.c	(revision 6d0e133f565ad653afea4c5cc6db4eed56b99b4f)
+++ common/str.c	(revision 6120b7ba197ea476787bce9a6b086bd533f93606)
@@ -156,4 +156,7 @@
 static inline int _char_continuation_bytes(char32_t c)
 {
+	if ((c & ~LO_MASK_32(7)) == 0)
+		return 0;
+
 	if ((c & ~LO_MASK_32(11)) == 0)
 		return 1;
@@ -223,6 +226,6 @@
 	/* Determine code length */
 
-	unsigned int cbytes = _continuation_bytes(b0);
-	unsigned int b0_bits = 6 - cbytes;  /* Data bits in first byte */
+	int cbytes = _continuation_bytes(b0);
+	int b0_bits = 6 - cbytes;  /* Data bits in first byte */
 
 	if (cbytes < 0 || *offset + cbytes > size)
