Skip to content
  • Michał Kępień's avatar
    Improve error handling in idn_ace_to_locale() · b896fc49
    Michał Kępień authored
    While idn2_to_unicode_8zlz() takes a 'flags' argument, it is ignored and
    thus cannot be used to perform IDN checks on the output string.
    
    The bug in libidn2 versions before 2.0.5 was not that a call to
    idn2_to_unicode_8zlz() with certain flags set did not cause IDN checks
    to be performed.  The bug was that idn2_to_unicode_8zlz() did not check
    whether a conversion can be performed between UTF-8 and the current
    locale's character encoding.  In other words, with libidn2 version
    2.0.5+, if the current locale's character encoding is ASCII, then
    idn2_to_unicode_8zlz() will fail when it is passed any Punycode string
    which decodes to a non-ASCII string, even if it is a valid IDNA2008
    name.
    
    Rework idn_ace_to_locale() so that invalid IDNA2008 names are properly
    and consistently detected for all libidn2 versions and locales.
    
    Update the "idna" system test accordingly.  Add checks for processing a
    server response containing Punycode which decodes to an invalid IDNA2008
    name.  Fix invalid subtest description.
    b896fc49