mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 22:44:49 +00:00
ICU-10639 detect the empty label before the ASCII dot in a domain name that contains nothing else
X-SVN-Rev: 34987
This commit is contained in:
parent
4e806c800e
commit
33db481060
2 changed files with 6 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2010-2012, International Business Machines
|
||||
* Copyright (C) 2010-2014, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
* file name: uts46.cpp
|
||||
|
@ -382,8 +382,7 @@ UTS46::process(const UnicodeString &src,
|
|||
break;
|
||||
}
|
||||
if(toASCII) {
|
||||
// Permit an empty label at the end but not elsewhere.
|
||||
if(i==labelStart && i<(srcLength-1)) {
|
||||
if(i==labelStart) {
|
||||
info.labelErrors|=UIDNA_ERROR_EMPTY_LABEL;
|
||||
} else if((i-labelStart)>63) {
|
||||
info.labelErrors|=UIDNA_ERROR_LABEL_TOO_LONG;
|
||||
|
@ -484,8 +483,7 @@ UTS46::processUTF8(const StringPiece &src,
|
|||
break; // Replacing with U+FFFD can be complicated for toASCII.
|
||||
}
|
||||
if(toASCII) {
|
||||
// Permit an empty label at the end but not elsewhere.
|
||||
if(i==labelStart && i<(srcLength-1)) {
|
||||
if(i==labelStart) {
|
||||
info.labelErrors|=UIDNA_ERROR_EMPTY_LABEL;
|
||||
} else if((i-labelStart)>63) {
|
||||
info.labelErrors|=UIDNA_ERROR_LABEL_TOO_LONG;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
*******************************************************************************
|
||||
* Copyright (C) 2010-2011, International Business Machines
|
||||
* Copyright (C) 2010-2014, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*******************************************************************************
|
||||
* file name: uts46test.cpp
|
||||
|
@ -466,6 +466,8 @@ static const TestCase testCases[]={
|
|||
"1234567890123456789012345678901234567890123456789012345678901",
|
||||
UIDNA_ERROR_LABEL_TOO_LONG|UIDNA_ERROR_DOMAIN_NAME_TOO_LONG },
|
||||
// hyphen errors and empty-label errors
|
||||
{ ".", "B", ".", UIDNA_ERROR_EMPTY_LABEL },
|
||||
{ "\\uFF0E", "B", ".", UIDNA_ERROR_EMPTY_LABEL },
|
||||
// "xn---q----jra"=="-q--a-umlaut-"
|
||||
{ "a.b..-q--a-.e", "B", "a.b..-q--a-.e",
|
||||
UIDNA_ERROR_EMPTY_LABEL|UIDNA_ERROR_LEADING_HYPHEN|UIDNA_ERROR_TRAILING_HYPHEN|
|
||||
|
|
Loading…
Add table
Reference in a new issue