From: Joseph Adams <joeyadams3.14159@gmail.com>
[ccan] / ccan / charset / test / run.c
index 9f3f90073dc0624e7bcfc064f56c849dfff6ce94..5504e886b9f9f111a9554aa5dfb70cfce42b96c2 100644 (file)
@@ -40,7 +40,8 @@ static unsigned int utf8_randcode(int len)
                case 3:
                        for (;;) {
                                ret = r % (0x10000-0x800) + 0x800;
-                               if (!utf8_allow_surrogates && ret >= 0xD800 && ret <= 0xDFFF)
+                               if ((!utf8_allow_surrogates && ret >= 0xD800 && ret <= 0xDFFF)
+                               || ret >= 0xFFFE)
                                {
                                        r = rand32();
                                        continue;