Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(8833)

Issue 6931049: code review 6931049: regexp: fix index panic in Replace

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 4 months ago by erikstmartin
Modified:
10 years, 9 months ago
Reviewers:
rsc
CC:
fss, golang-dev
Visibility:
Public.

Description

regexp: fix index panic in Replace When using subexpressions ($1) as replacements, when they either don't exist or values weren't found causes a panic. This patch ensures that the match location isn't -1, to prevent out of bounds errors. Fixes issue 3816.

Patch Set 1 #

Patch Set 2 : diff -r ec3ae5b98922 https://code.google.com/p/go #

Patch Set 3 : diff -r ec3ae5b98922 https://code.google.com/p/go #

Total comments: 1

Patch Set 4 : diff -r ec3ae5b98922 https://code.google.com/p/go #

Total comments: 2

Patch Set 5 : diff -r ec3ae5b98922 https://code.google.com/p/go #

Patch Set 6 : diff -r ec3ae5b98922 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+5 lines, -1 line) Patch
M src/pkg/regexp/all_test.go View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M src/pkg/regexp/regexp.go View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 16
erikstmartin
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go
11 years, 4 months ago (2012-12-12 02:52:57 UTC) #1
fss
https://codereview.appspot.com/6931049/diff/5001/src/pkg/regexp/all_test.go File src/pkg/regexp/all_test.go (right): https://codereview.appspot.com/6931049/diff/5001/src/pkg/regexp/all_test.go#newcode200 src/pkg/regexp/all_test.go:200: // Subtitution when subexpression isn't found s/Subtitution/Substitution/
11 years, 4 months ago (2012-12-12 03:00:07 UTC) #2
erikstmartin
oops, typo. Let me update that. Thanks :) On Tuesday, December 11, 2012 10:00:07 PM ...
11 years, 4 months ago (2012-12-12 03:03:50 UTC) #3
erikstmartin
Hello golang-dev@googlegroups.com, franciscossouza@gmail.com (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 4 months ago (2012-12-12 03:05:22 UTC) #4
rsc
looks good thanks not sure what the ... in the CL desc is for regexp: ...
11 years, 4 months ago (2012-12-12 04:17:39 UTC) #5
erikstmartin
I think it's just truncating the description because it's too long, and adding an ellipsis ...
11 years, 4 months ago (2012-12-12 04:26:13 UTC) #6
rsc
Oh, right. Either way, please make the first line just: regexp: fix index panic in ...
11 years, 4 months ago (2012-12-12 19:25:10 UTC) #7
erikstmartin
On 2012/12/12 19:25:10, rsc wrote: > Oh, right. Either way, please make the first line ...
11 years, 4 months ago (2012-12-12 19:28:26 UTC) #8
erikstmartin
On 2012/12/12 19:28:26, erikstmartin wrote: > On 2012/12/12 19:25:10, rsc wrote: > > Oh, right. ...
11 years, 4 months ago (2012-12-19 15:20:17 UTC) #9
rsc
It looks like you need to run 'hg upload 6931049'.
11 years, 3 months ago (2012-12-22 15:14:51 UTC) #10
erikstmartin
On 2012/12/22 15:14:51, rsc wrote: > It looks like you need to run 'hg upload ...
11 years, 3 months ago (2012-12-22 15:36:40 UTC) #11
rsc
https://codereview.appspot.com/6931049/diff/2002/src/pkg/regexp/regexp.go File src/pkg/regexp/regexp.go (right): https://codereview.appspot.com/6931049/diff/2002/src/pkg/regexp/regexp.go#newcode770 src/pkg/regexp/regexp.go:770: if 2*num+1 < len(match) && match[2*num+1] >= 0 { ...
11 years, 3 months ago (2012-12-22 15:41:55 UTC) #12
erikstmartin
On 2012/12/22 15:41:55, rsc wrote: > https://codereview.appspot.com/6931049/diff/2002/src/pkg/regexp/regexp.go > File src/pkg/regexp/regexp.go (right): > > https://codereview.appspot.com/6931049/diff/2002/src/pkg/regexp/regexp.go#newcode770 > ...
11 years, 3 months ago (2012-12-22 15:57:41 UTC) #13
rsc
*** Submitted as https://code.google.com/p/go/source/detail?r=2414f5fb898d *** regexp: fix index panic in Replace When using subexpressions ($1) ...
11 years, 3 months ago (2012-12-22 16:14:59 UTC) #14
rsc
LGTM
11 years, 3 months ago (2012-12-22 16:15:33 UTC) #15
remyoudompheng
10 years, 9 months ago (2013-07-20 20:01:06 UTC) #16
R=close
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b