ICU-5161 Fix valgrind and Purify warnings about getTerminatedBuffer and uninitialized memory reads.
X-SVN-Rev: 19548
This commit is contained in:
parent
e88c000399
commit
4493abae62
@ -581,6 +581,10 @@ void TransliteratorIDParser::STVtoID(const UnicodeString& source,
|
||||
if (variant.length() != 0) {
|
||||
id.append(VARIANT_SEP).append(variant);
|
||||
}
|
||||
// NUL-terminate the ID string for getTerminatedBuffer.
|
||||
// This prevents valgrind and Purify warnings.
|
||||
id.append((UChar)0);
|
||||
id.truncate(id.length()-1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1298,8 +1298,9 @@ inline int32_t Transliterator::getMaximumContextLength(void) const {
|
||||
|
||||
inline void Transliterator::setID(const UnicodeString& id) {
|
||||
ID = id;
|
||||
// NUL-terminate the ID string
|
||||
ID.getTerminatedBuffer();
|
||||
// NUL-terminate the ID string, which is a non-aliased copy.
|
||||
ID.append((UChar)0);
|
||||
ID.truncate(ID.length()-1);
|
||||
}
|
||||
|
||||
inline Transliterator::Token Transliterator::integerToken(int32_t i) {
|
||||
|
Loading…
Reference in New Issue
Block a user