if (U_FAILURE(*fRB->fStatus)) {
return NULL;
}
- fNodeStackPtr++;
- if (fNodeStackPtr >= kStackSize) {
- error(U_BRK_INTERNAL_ERROR);
+ if (fNodeStackPtr >= kStackSize - 1) {
+ error(U_BRK_RULE_SYNTAX);
RBBIDebugPuts("RBBIRuleScanner::pushNewNode - stack overflow.");
- *fRB->fStatus = U_BRK_INTERNAL_ERROR;
return NULL;
}
+ fNodeStackPtr++;
fNodeStack[fNodeStackPtr] = new RBBINode(t);
if (fNodeStack[fNodeStackPtr] == NULL) {
*fRB->fStatus = U_MEMORY_ALLOCATION_ERROR;
TESTCASE_AUTO(TestBug7547);
TESTCASE_AUTO(TestBug12797);
TESTCASE_AUTO(TestBug12918);
+ TESTCASE_AUTO(TestBug12932);
TESTCASE_AUTO_END;
}
ubrk_close(iter);
}
+void RBBITest::TestBug12932() {
+ // Node Stack overflow in the RBBI rule parser caused a seg fault.
+ UnicodeString ruleStr(
+ "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((("
+ "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((("
+ "(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((()))"
+ ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))"
+ ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))"
+ ")))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))");
+
+ UErrorCode status = U_ZERO_ERROR;
+ UParseError parseError;
+ RuleBasedBreakIterator rbbi(ruleStr, parseError, status);
+ if (status != U_BRK_RULE_SYNTAX) {
+ errln("%s:%d expected U_BRK_RULE_SYNTAX, got %s",
+ __FILE__, __LINE__, u_errorName(status));
+ }
+}
+
+
//
// TestDebug - A place-holder test for debugging purposes.
// For putting in fragments of other tests that can be invoked
// for tracing without a lot of unwanted extra stuff happening.
//
void RBBITest::TestDebug(void) {
-
}
void RBBITest::TestProperties() {