@@ -1601,27 +1601,13 @@ 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
- /* If there were no malformations, or the only malformation is an
1605
- * overlong, 'uv' is valid */
1606
- if ( LIKELY (! (possible_problems & ~UTF8_GOT_LONG ))
1607
- && isUNICODE_POSSIBLY_PROBLEMATIC (uv ))
1608
- {
1609
- if (UNLIKELY (UNICODE_IS_SURROGATE (uv ))) {
1610
- possible_problems |= UTF8_GOT_SURROGATE ;
1611
- }
1612
- else if (UNLIKELY (UNICODE_IS_SUPER (uv ))) {
1613
- possible_problems |= UTF8_GOT_SUPER ;
1614
- }
1615
- else if (UNLIKELY (UNICODE_IS_NONCHAR (uv ))) {
1616
- possible_problems |= UTF8_GOT_NONCHAR ;
1617
- }
1618
- }
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
- {
1604
+ if (UNLIKELY (possible_problems & ~UTF8_GOT_LONG )) {
1605
+
1606
+ /* Here, there is a malformation other than overlong, we need to
1607
+ look at the source UTF-8, possibly adjusted to be non-overlong */
1608
+ if ( isUTF8_POSSIBLY_PROBLEMATIC (* adjusted_s0 )
1609
+ || UNLIKELY (UTF8_IS_PERL_EXTENDED (s0 )))
1610
+ {
1625
1611
if (UNLIKELY (NATIVE_UTF8_TO_I8 (* adjusted_s0 )
1626
1612
> UTF_START_BYTE_110000_ ))
1627
1613
{
@@ -1642,7 +1628,24 @@ Perl__utf8n_to_uvchr_msgs_helper(const U8 *s,
1642
1628
1643
1629
/* We need a complete well-formed UTF-8 character to discern
1644
1630
* non-characters, so can't look for them here */
1631
+ }
1645
1632
}
1633
+ else
1634
+
1635
+ /* Here there were no malformations, or the only malformation is an
1636
+ * overlong, 'uv' is valid, and the 'if' above made sure that it
1637
+ * could be problematic */
1638
+ if (isUNICODE_POSSIBLY_PROBLEMATIC (uv )) {
1639
+ if (UNLIKELY (UNICODE_IS_SURROGATE (uv ))) {
1640
+ possible_problems |= UTF8_GOT_SURROGATE ;
1641
+ }
1642
+ else if (UNLIKELY (UNICODE_IS_SUPER (uv ))) {
1643
+ possible_problems |= UTF8_GOT_SUPER ;
1644
+ }
1645
+ else if (UNLIKELY (UNICODE_IS_NONCHAR (uv ))) {
1646
+ possible_problems |= UTF8_GOT_NONCHAR ;
1647
+ }
1648
+ }
1646
1649
}
1647
1650
1648
1651
ready_to_handle_errors :
0 commit comments