blob: 1798d18abcb79c68b05fe7b6625c7a971d5d0475 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
$NetBSD: patch-bc,v 1.1 2008/03/20 17:07:54 drochner Exp $
--- i18n/regexcmp.cpp.orig 2006-02-02 05:37:14.000000000 +0100
+++ i18n/regexcmp.cpp
@@ -1187,14 +1187,17 @@ UBool RegexCompile::doParseActions(EPars
// Because capture groups can be forward-referenced by back-references,
// we fill the operand with the capture group number. At the end
// of compilation, it will be changed to the variable's location.
- U_ASSERT(groupNum > 0);
- int32_t op;
- if (fModeFlags & UREGEX_CASE_INSENSITIVE) {
- op = URX_BUILD(URX_BACKREF_I, groupNum);
+ if (groupNum < 1) {
+ error(U_REGEX_INVALID_BACK_REF);
} else {
- op = URX_BUILD(URX_BACKREF, groupNum);
+ int32_t op;
+ if (fModeFlags & UREGEX_CASE_INSENSITIVE) {
+ op = URX_BUILD(URX_BACKREF_I, groupNum);
+ } else {
+ op = URX_BUILD(URX_BACKREF, groupNum);
+ }
+ fRXPat->fCompiledPat->addElement(op, *fStatus);
}
- fRXPat->fCompiledPat->addElement(op, *fStatus);
}
break;
|