@@ -1601,16 +1601,11 @@ Perl__utf8n_to_uvchr_msgs_helper(const U8 *s,
1601
1601
* the overflow handling code */
1602
1602
&& LIKELY (! (possible_problems & UTF8_GOT_OVERFLOW )))
1603
1603
{
1604
- /* uv is valid for overlongs */
1605
- if ( ( LIKELY (! (possible_problems & ~UTF8_GOT_LONG ))
1606
- && isUNICODE_POSSIBLY_PROBLEMATIC (uv ))
1607
- || ( UNLIKELY (possible_problems )
1608
- && ( isUTF8_POSSIBLY_PROBLEMATIC (* adjusted_s0 )
1609
- || UNLIKELY (UTF8_IS_PERL_EXTENDED (s0 )))))
1610
- {
1611
1604
/* If there were no malformations, or the only malformation is an
1612
1605
* overlong, 'uv' is valid */
1613
- if (LIKELY (! (possible_problems & ~UTF8_GOT_LONG ))) {
1606
+ if ( LIKELY (! (possible_problems & ~UTF8_GOT_LONG ))
1607
+ && isUNICODE_POSSIBLY_PROBLEMATIC (uv ))
1608
+ {
1614
1609
if (UNLIKELY (UNICODE_IS_SURROGATE (uv ))) {
1615
1610
possible_problems |= UTF8_GOT_SURROGATE ;
1616
1611
}
@@ -1621,9 +1616,12 @@ Perl__utf8n_to_uvchr_msgs_helper(const U8 *s,
1621
1616
possible_problems |= UTF8_GOT_NONCHAR ;
1622
1617
}
1623
1618
}
1624
- else { /* Otherwise, need to look at the source UTF-8, possibly
1625
- adjusted to be non-overlong */
1626
-
1619
+ else if ( UNLIKELY (possible_problems )
1620
+ /* Otherwise, need to look at the source UTF-8,
1621
+ * possibly adjusted to be non-overlong */
1622
+ && ( isUTF8_POSSIBLY_PROBLEMATIC (* adjusted_s0 )
1623
+ || UNLIKELY (UTF8_IS_PERL_EXTENDED (s0 ))))
1624
+ {
1627
1625
if (UNLIKELY (NATIVE_UTF8_TO_I8 (* adjusted_s0 )
1628
1626
> UTF_START_BYTE_110000_ ))
1629
1627
{
@@ -1645,7 +1643,6 @@ Perl__utf8n_to_uvchr_msgs_helper(const U8 *s,
1645
1643
/* We need a complete well-formed UTF-8 character to discern
1646
1644
* non-characters, so can't look for them here */
1647
1645
}
1648
- }
1649
1646
}
1650
1647
1651
1648
ready_to_handle_errors :
0 commit comments