# # Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. # Add NULL checks to getBuffer calls https://unicode-org.atlassian.net/browse/ICU-12378 --- icu/source/common/uts46.cpp.orig +++ icu/source/common/uts46.cpp @@ -924,7 +924,12 @@ UBool disallowNonLDHDot=(options&UIDNA_USE_STD3_RULES)!=0; UBool isASCII=true; UBool onlyLDH=true; - const char16_t *label=dest.getBuffer()+labelStart; + const char16_t *l=dest.getBuffer(); + if(l==nullptr) { + info.labelErrors|=UIDNA_ERROR_LABEL_TOO_LONG; + return 0; + } + const char16_t *label=l+labelStart; const char16_t *limit=label+labelLength; // Start after the initial "xn--". // Ok to cast away const because we own the UnicodeString.