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

Issue 5530051: code review 5530051: strconv: return ErrSyntax when unquoting illegal octal ... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 6 months ago by Sameer Ajmani
Modified:
13 years, 6 months ago
Reviewers:
MikeSamuel
CC:
golang-dev, rsc, r, r2, nigeltao
Visibility:
Public.

Description

strconv: return ErrSyntax when unquoting illegal octal sequences. This is consistent with what the Go compiler returns when such sequences appear in string literals. Fixes issue 2658.

Patch Set 1 #

Patch Set 2 : diff -r eeace7be331a https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r eeace7be331a https://go.googlecode.com/hg/ #

Total comments: 2

Patch Set 4 : diff -r 9fac7377fc7e https://go.googlecode.com/hg/ #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+19 lines, -10 lines) Patch
M src/pkg/html/template/escape_test.go View 1 2 1 chunk +12 lines, -10 lines 2 comments Download
M src/pkg/strconv/quote.go View 1 1 chunk +1 line, -0 lines 0 comments Download
M src/pkg/strconv/quote_test.go View 1 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 14
Sameer Ajmani
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 6 months ago (2012-01-09 16:45:58 UTC) #1
rsc
LGTM
13 years, 6 months ago (2012-01-09 19:25:41 UTC) #2
r
http://codereview.appspot.com/5530051/diff/2001/src/pkg/html/template/escape_test.go File src/pkg/html/template/escape_test.go (right): http://codereview.appspot.com/5530051/diff/2001/src/pkg/html/template/escape_test.go#newcode303 src/pkg/html/template/escape_test.go:303: // This test is broken by the fix to ...
13 years, 6 months ago (2012-01-09 19:26:46 UTC) #3
r2
On Jan 9, 2012, at 11:25 AM, Russ Cox wrote: > LGTM does not LGTM
13 years, 6 months ago (2012-01-09 19:27:29 UTC) #4
Sameer Ajmani
http://codereview.appspot.com/5530051/diff/2001/src/pkg/html/template/escape_test.go File src/pkg/html/template/escape_test.go (right): http://codereview.appspot.com/5530051/diff/2001/src/pkg/html/template/escape_test.go#newcode303 src/pkg/html/template/escape_test.go:303: // This test is broken by the fix to ...
13 years, 6 months ago (2012-01-09 23:13:31 UTC) #5
rsc
Package html is using go's strconv.UnquoteChar to unescape a non-Go string literal (maybe a JavaScript ...
13 years, 6 months ago (2012-01-09 23:16:07 UTC) #6
rsc
I should add that I think it's fine to disable the test in html for ...
13 years, 6 months ago (2012-01-09 23:16:36 UTC) #7
r2
On Jan 9, 2012, at 3:16 PM, Russ Cox wrote: > I should add that ...
13 years, 6 months ago (2012-01-09 23:48:32 UTC) #8
nigeltao
On 10 January 2012 10:16, Russ Cox <rsc@golang.org> wrote: > I should add that I ...
13 years, 6 months ago (2012-01-09 23:54:15 UTC) #9
Sameer Ajmani
*** Submitted as http://code.google.com/p/go/source/detail?r=41199a4a9166 *** strconv: return ErrSyntax when unquoting illegal octal sequences. This is ...
13 years, 6 months ago (2012-01-10 00:57:05 UTC) #10
MikeSamuel
2012/1/9 Nigel Tao <nigeltao@golang.org>: > On 10 January 2012 10:16, Russ Cox <rsc@golang.org> wrote: >> ...
13 years, 6 months ago (2012-01-11 20:20:44 UTC) #11
MikeSamuel
http://codereview.appspot.com/5530051/diff/5003/src/pkg/html/template/escape_test.go File src/pkg/html/template/escape_test.go (right): http://codereview.appspot.com/5530051/diff/5003/src/pkg/html/template/escape_test.go#newcode306 src/pkg/html/template/escape_test.go:306: // `<p style="width: {{" e\78preS\0Sio/**/n(alert(1337))"}}">`, I'm stupid. This and ...
13 years, 6 months ago (2012-01-11 20:25:03 UTC) #12
r2
On Jan 11, 2012, at 12:25 PM, mikesamuel@gmail.com wrote: > > http://codereview.appspot.com/5530051/diff/5003/src/pkg/html/template/escape_test.go > File src/pkg/html/template/escape_test.go ...
13 years, 6 months ago (2012-01-11 20:27:13 UTC) #13
MikeSamuel
13 years, 6 months ago (2012-01-11 21:30:53 UTC) #14
2012/1/11 Rob 'Commander' Pike <r@google.com>:
>
> On Jan 11, 2012, at 12:25 PM, mikesamuel@gmail.com wrote:
>
>>
>>
http://codereview.appspot.com/5530051/diff/5003/src/pkg/html/template/escape_...
>> File src/pkg/html/template/escape_test.go (right):
>>
>>
http://codereview.appspot.com/5530051/diff/5003/src/pkg/html/template/escape_...
>> src/pkg/html/template/escape_test.go:306: //  `<p style="width: {{"
>> e\78preS\0Sio/**/n(alert(1337))"}}">`,
>> I'm stupid.  This and the below are meant to be testing literal CSS
>> text, so
>>
>>   "  e\78preS\0Sio/**/n(alert(1337))"
>
>>
>> should be
>>
>>   "  e\\78preS\0Sio/**/n(alert(1337))"
>>
>> The \78 is not meant to be an octal sequence as seen by the template
>> parser, but as a hex sequence as seen by the CSS decoder.
>
> in go, octal constants must be three digits, so you need to do something about
\0 too.
>
>>
>>
http://codereview.appspot.com/5530051/diff/5003/src/pkg/html/template/escape_...
>> src/pkg/html/template/escape_test.go:317: //  `<p style="{{"
>> -mo\7a-B\0I/**/nding(alert(1337))"}}: ...">`,
>> Similarly for the \7a here.
>>
>>    "  -mo\7a-B\0I/**/nding(alert(1337))"
>>
>> should be
>>
>>    "  -mo\\7a-B\0I/**/nding(alert(1337))"
>>
>> http://codereview.appspot.com/5530051/
>

I will send out a CL shortly.
Sign in to reply to this message.

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