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

Issue 2967041: code review 2967041: Inspect byte sequences read in xml.text() for presence ... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 8 months ago by nk
Modified:
14 years, 7 months ago
Reviewers:
CC:
rsc, golang-dev
Visibility:
Public.

Description

Inspect byte sequences read in xml.text() for presence of XML disallowed characters. Uses a second bytes.Buffer to inspect bytes read into the data slice rune-by-rune. New var CharacterRange []unicode.Range (taken from http://www.xml.com/axml/testaxml.htm Section 2.2 Characters) created to assist in the inspection. Test case "TestDisallowedCharacters" added to xml_test.go. This change adds time to parses: locally, a sample NLM Medline file of 59 megabytes averages 9.3 seconds over 5 consecutive runs to process without the inspection, and 10.0 seconds to process with the inspection. Very short files appear to take some thousands of nano-seconds longer. Not a scientific analysis of the difference. Fixes issue 1259.

Patch Set 1 #

Patch Set 2 : code review 2967041: Inspect byte sequences read in xml.text() for presence ... #

Total comments: 6

Patch Set 3 : code review 2967041: Inspect byte sequences read in xml.text() for presence ... #

Total comments: 12

Patch Set 4 : code review 2967041: Inspect byte sequences read in xml.text() for presence ... #

Patch Set 5 : This is an attempt to get xml.go and xml_test.go back into the change list. #

Patch Set 6 : code review 2967041: Inspect byte sequences read in xml.text() for presence ... #

Total comments: 4

Patch Set 7 : code review 2967041: Inspect byte sequences read in xml.text() for presence ... #

Unified diffs Side-by-side diffs Delta from patch set Stats (+69 lines, -0 lines) Patch
M src/pkg/xml/xml.go View 1 2 3 5 6 3 chunks +28 lines, -0 lines 0 comments Download
M src/pkg/xml/xml_test.go View 1 2 3 5 6 1 chunk +41 lines, -0 lines 0 comments Download

Messages

Total messages: 16
nk
Hello rsc (cc: golang-dev@googlegroups.com), I'd like you to review this change.
14 years, 8 months ago (2010-11-07 17:41:02 UTC) #1
nigeltao
Cosmetic-only pass for now. http://codereview.appspot.com/2967041/diff/2001/src/pkg/xml/xml.go File src/pkg/xml/xml.go (right): http://codereview.appspot.com/2967041/diff/2001/src/pkg/xml/xml.go#newcode874 src/pkg/xml/xml.go:874: // inspect data's contents for ...
14 years, 8 months ago (2010-11-08 05:14:58 UTC) #2
nk
Hello rsc, nigeltao (cc: golang-dev@googlegroups.com), Please take another look.
14 years, 8 months ago (2010-11-08 15:28:25 UTC) #3
nigeltao
http://codereview.appspot.com/2967041/diff/9001/src/pkg/xml/xml.go File src/pkg/xml/xml.go (right): http://codereview.appspot.com/2967041/diff/9001/src/pkg/xml/xml.go#newcode875 src/pkg/xml/xml.go:875: inspect := bytes.NewBuffer(data) Using a bytes.Buffer just to pick ...
14 years, 8 months ago (2010-11-09 00:24:38 UTC) #4
nk
Thanks for the review. http://codereview.appspot.com/2967041/diff/9001/src/pkg/xml/xml.go File src/pkg/xml/xml.go (right): http://codereview.appspot.com/2967041/diff/9001/src/pkg/xml/xml.go#newcode877 src/pkg/xml/xml.go:877: if !unicode.Is(CharacterRange, r) { I ...
14 years, 8 months ago (2010-11-09 14:28:49 UTC) #5
rsc1
Thanks. This is a nice place to put the check. http://codereview.appspot.com/2967041/diff/9001/src/pkg/xml/xml.go File src/pkg/xml/xml.go (right): http://codereview.appspot.com/2967041/diff/9001/src/pkg/xml/xml.go#newcode875 ...
14 years, 7 months ago (2010-11-15 21:43:55 UTC) #6
nk
http://codereview.appspot.com/2967041/diff/9001/src/pkg/xml/xml.go File src/pkg/xml/xml.go (right): http://codereview.appspot.com/2967041/diff/9001/src/pkg/xml/xml.go#newcode875 src/pkg/xml/xml.go:875: inspect := bytes.NewBuffer(data) Duly noted!
14 years, 7 months ago (2010-11-16 20:07:29 UTC) #7
nk
Hello rsc (cc: golang-dev@googlegroups.com), Please take another look.
14 years, 7 months ago (2010-11-19 14:50:31 UTC) #8
nk
Hello rsc, et a, I am sorry for this empty review, I am apparently having ...
14 years, 7 months ago (2010-11-19 15:18:56 UTC) #9
nk
Hello rsc (cc: golang-dev@googlegroups.com), Please take another look.
14 years, 7 months ago (2010-11-23 14:31:52 UTC) #10
rsc
looks pretty good http://codereview.appspot.com/2967041/diff/27001/src/pkg/xml/xml.go File src/pkg/xml/xml.go (right): http://codereview.appspot.com/2967041/diff/27001/src/pkg/xml/xml.go#newcode909 src/pkg/xml/xml.go:909: return (rune == 0x09 || can ...
14 years, 7 months ago (2010-12-07 18:02:48 UTC) #11
nk
This all duly noted. I appreciate the time you have take on the style corrections ...
14 years, 7 months ago (2010-12-09 02:23:49 UTC) #12
nk
Hello rsc (cc: golang-dev@googlegroups.com), Please take another look.
14 years, 7 months ago (2010-12-09 03:15:05 UTC) #13
rsc1
LGTM
14 years, 7 months ago (2010-12-09 18:23:01 UTC) #14
rsc
It looks like you need to complete a CLA as described at http://golang.org/doc/contribute.html#copyright. Thanks. Russ
14 years, 7 months ago (2010-12-09 18:24:18 UTC) #15
rsc
14 years, 7 months ago (2010-12-09 19:51:03 UTC) #16
*** Submitted as 09689e5864bb ***

xml: disallow invalid Unicode code points

Fixes issue 1259.

R=rsc
CC=golang-dev
http://codereview.appspot.com/2967041

Committer: Russ Cox <rsc@golang.org>
Sign in to reply to this message.

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