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

Side by Side Diff: src/ia32/regexp-macro-assembler-ia32.cc

Issue 10536170: Add missing string length check in regexp engine. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments addressed Created 8 years, 6 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 | « no previous file | src/x64/regexp-macro-assembler-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 309
310 // The length of a capture should not be negative. This can only happen 310 // The length of a capture should not be negative. This can only happen
311 // if the end of the capture is unrecorded, or at a point earlier than 311 // if the end of the capture is unrecorded, or at a point earlier than
312 // the start of the capture. 312 // the start of the capture.
313 BranchOrBacktrack(less, on_no_match); 313 BranchOrBacktrack(less, on_no_match);
314 314
315 // If length is zero, either the capture is empty or it is completely 315 // If length is zero, either the capture is empty or it is completely
316 // uncaptured. In either case succeed immediately. 316 // uncaptured. In either case succeed immediately.
317 __ j(equal, &fallthrough); 317 __ j(equal, &fallthrough);
318 318
319 // Check that there are sufficient characters left in the input.
320 __ mov(eax, edi);
321 __ add(eax, ebx);
322 BranchOrBacktrack(greater, on_no_match);
323
319 if (mode_ == ASCII) { 324 if (mode_ == ASCII) {
320 Label success; 325 Label success;
321 Label fail; 326 Label fail;
322 Label loop_increment; 327 Label loop_increment;
323 // Save register contents to make the registers available below. 328 // Save register contents to make the registers available below.
324 __ push(edi); 329 __ push(edi);
325 __ push(backtrack_stackpointer()); 330 __ push(backtrack_stackpointer());
326 // After this, the eax, ecx, and edi registers are available. 331 // After this, the eax, ecx, and edi registers are available.
327 332
328 __ add(edx, esi); // Start of capture 333 __ add(edx, esi); // Start of capture
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
1394 } 1399 }
1395 1400
1396 1401
1397 #undef __ 1402 #undef __
1398 1403
1399 #endif // V8_INTERPRETED_REGEXP 1404 #endif // V8_INTERPRETED_REGEXP
1400 1405
1401 }} // namespace v8::internal 1406 }} // namespace v8::internal
1402 1407
1403 #endif // V8_TARGET_ARCH_IA32 1408 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | src/x64/regexp-macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698