Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: third_party/icu38/source/i18n/regexcmp.cpp

Issue 40038: Apply a security patch for ICU regex. (http://bugs.icu-project.org/trac/ticke... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/icu38/source/common/uvectr32.cpp ('k') | third_party/icu38/source/i18n/rematch.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 // 2 //
3 // file: regexcmp.cpp 3 // file: regexcmp.cpp
4 // 4 //
5 // Copyright (C) 2002-2007 International Business Machines Corporation and othe rs. 5 // Copyright (C) 2002-2008 International Business Machines Corporation and othe rs.
6 // All Rights Reserved. 6 // All Rights Reserved.
7 // 7 //
8 // This file contains the ICU regular expression compiler, which is responsible 8 // This file contains the ICU regular expression compiler, which is responsible
9 // for processing a regular expression pattern into the compiled form that 9 // for processing a regular expression pattern into the compiled form that
10 // is used by the match finding engine. 10 // is used by the match finding engine.
11 // 11 //
12 12
13 #include "unicode/utypes.h" 13 #include "unicode/utypes.h"
14 14
15 #if !UCONFIG_NO_REGULAR_EXPRESSIONS 15 #if !UCONFIG_NO_REGULAR_EXPRESSIONS
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 break; 1179 break;
1180 } 1180 }
1181 nextCharLL(); 1181 nextCharLL();
1182 } 1182 }
1183 1183
1184 // Scan of the back reference in the source regexp is complete. Now generate 1184 // Scan of the back reference in the source regexp is complete. Now generate
1185 // the compiled code for it. 1185 // the compiled code for it.
1186 // Because capture groups can be forward-referenced by back-referenc es, 1186 // Because capture groups can be forward-referenced by back-referenc es,
1187 // we fill the operand with the capture group number. At the end 1187 // we fill the operand with the capture group number. At the end
1188 // of compilation, it will be changed to the variable's location. 1188 // of compilation, it will be changed to the variable's location.
1189 U_ASSERT(groupNum > 0); 1189 if (groupNum < 1) {
1190 int32_t op; 1190 error(U_REGEX_INVALID_BACK_REF);
1191 if (fModeFlags & UREGEX_CASE_INSENSITIVE) {
1192 op = URX_BUILD(URX_BACKREF_I, groupNum);
1193 } else { 1191 } else {
1194 op = URX_BUILD(URX_BACKREF, groupNum); 1192 int32_t op;
1193 if (fModeFlags & UREGEX_CASE_INSENSITIVE) {
1194 op = URX_BUILD(URX_BACKREF_I, groupNum);
1195 } else {
1196 op = URX_BUILD(URX_BACKREF, groupNum);
1197 }
1198 fRXPat->fCompiledPat->addElement(op, *fStatus);
1195 } 1199 }
1196 fRXPat->fCompiledPat->addElement(op, *fStatus);
1197 } 1200 }
1198 break; 1201 break;
1199 1202
1200 1203
1201 case doPossessivePlus: 1204 case doPossessivePlus:
1202 // Possessive ++ quantifier. 1205 // Possessive ++ quantifier.
1203 // Compiles to 1206 // Compiles to
1204 // 1. STO_SP 1207 // 1. STO_SP
1205 // 2. body of stuff being iterated over 1208 // 2. body of stuff being iterated over
1206 // 3. STATE_SAVE 5 1209 // 3. STATE_SAVE 5
(...skipping 2313 matching lines...) Expand 10 before | Expand all | Expand 10 after
3520 uset = NULL; 3523 uset = NULL;
3521 } 3524 }
3522 3525
3523 nextChar(fC); // Continue overall regex pattern processing with char af ter the '}' 3526 nextChar(fC); // Continue overall regex pattern processing with char af ter the '}'
3524 return uset; 3527 return uset;
3525 } 3528 }
3526 3529
3527 U_NAMESPACE_END 3530 U_NAMESPACE_END
3528 #endif // !UCONFIG_NO_REGULAR_EXPRESSIONS 3531 #endif // !UCONFIG_NO_REGULAR_EXPRESSIONS
3529 3532
OLDNEW
« no previous file with comments | « third_party/icu38/source/common/uvectr32.cpp ('k') | third_party/icu38/source/i18n/rematch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698