@@ -1832,7 +1832,17 @@ Perl_utf8_to_uv_msgs_helper_(const U8 * const s0,
1832
1832
if (UTF8_IS_SYNTACTIC_START_BYTE (s0 )) {
1833
1833
overlong_detect_length = is_utf8_overlong (s0 , s - s0 );
1834
1834
if (UNLIKELY (overlong_detect_length > 0 )) {
1835
- possible_problems |= UTF8_GOT_LONG ;
1835
+
1836
+ /* Two flags control the same malformation. The more restrictive
1837
+ * and less likely one causes the other one to be set as well, so
1838
+ * as to simplify the code below. */
1839
+ if (UNLIKELY (flags & UTF8_ALLOW_LONG_AND_ITS_VALUE )) {
1840
+ possible_problems |= UTF8_GOT_LONG_WITH_VALUE ;
1841
+ flags |= UTF8_ALLOW_LONG ;
1842
+ }
1843
+ else {
1844
+ possible_problems |= UTF8_GOT_LONG ;
1845
+ }
1836
1846
}
1837
1847
}
1838
1848
@@ -2236,11 +2246,8 @@ Perl_utf8_to_uv_msgs_helper_(const U8 * const s0,
2236
2246
}
2237
2247
2238
2248
case UTF8_GOT_LONG :
2239
-
2240
- if (! (flags & ( UTF8_ALLOW_LONG
2241
- |UTF8_ALLOW_LONG_AND_ITS_VALUE )))
2242
- {
2243
- if (PACK_WARN (WARN_UTF8 ,,)) {
2249
+ case UTF8_GOT_LONG_WITH_VALUE :
2250
+ COMMON_DEFAULT_REJECTS (,);
2244
2251
2245
2252
/* These error types cause 'input_uv' to be something
2246
2253
* that isn't what was intended, so can't use it in the
@@ -2284,9 +2291,6 @@ Perl_utf8_to_uv_msgs_helper_(const U8 * const s0,
2284
2291
points */
2285
2292
UNI_TO_NATIVE (input_uv ));
2286
2293
}
2287
- }
2288
- }
2289
-
2290
2294
break ;
2291
2295
2292
2296
case UTF8_GOT_SURROGATE :
0 commit comments