From 3f18f9624691f20df43cdecd715646e0fa18369a Mon Sep 17 00:00:00 2001 From: Jungshik Shin Date: Wed, 15 Feb 2012 00:41:48 +0000 Subject: [PATCH] ICU-9115 ubrk_setText does not check the input (Null check) X-SVN-Rev: 31397 --- icu4c/source/common/ubrk.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/icu4c/source/common/ubrk.cpp b/icu4c/source/common/ubrk.cpp index f6a70efeeae..be012373c10 100644 --- a/icu4c/source/common/ubrk.cpp +++ b/icu4c/source/common/ubrk.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************** -* Copyright (C) 1996-2011, International Business Machines +* Copyright (C) 1996-2012, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************** */ @@ -166,6 +166,12 @@ ubrk_setText(UBreakIterator* bi, int32_t textLength, UErrorCode* status) { + if (bi == NULL) { + if (U_SUCCESS(*status)) { + *status = U_ILLEGAL_ARGUMENT_ERROR; + } + return; + } BreakIterator *brit = (BreakIterator *)bi; UText ut = UTEXT_INITIALIZER; utext_openUChars(&ut, text, textLength, status); @@ -181,6 +187,12 @@ ubrk_setUText(UBreakIterator *bi, UText *text, UErrorCode *status) { + if (bi == NULL) { + if (U_SUCCESS(*status)) { + *status = U_ILLEGAL_ARGUMENT_ERROR; + } + return; + } RuleBasedBreakIterator *brit = (RuleBasedBreakIterator *)bi; brit->RuleBasedBreakIterator::setText(text, *status); }