File: CVE-2018-17847_CVE-2018-17848_4b62a64.patch

package info (click to toggle)
golang-golang-x-net-dev 1%3A0.0%2Bgit20181201.351d144%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster, buster-backports, buster-backports-sloppy, experimental
  • size: 5,676 kB
  • sloc: makefile: 53; asm: 18
file content (67 lines) | stat: -rw-r--r-- 1,827 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
From 4b62a64f59f73840b9ab79204c94fee61cd1ba2c Mon Sep 17 00:00:00 2001
From: Kunpei Sakai <namusyaka@gmail.com>
Date: Fri, 25 Jan 2019 02:28:59 +0900
Subject: [PATCH] html: make (*nodeStack)contains distinguish namespace

By proceeding without distinguishing namespace, inconsistency will
occur.
This commit makes the method distinguish the HTML namespace.

Fixes golang/go#27846

Change-Id: I8269f670240c0fe31162a16fbe1ac23acacec00f
Reviewed-on: https://go-review.googlesource.com/c/159397
Run-TryBot: Kunpei Sakai <namusyaka@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
---
 html/node.go                  |  2 +-
 html/testdata/go/template.dat | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/html/node.go b/html/node.go
index 2c1cade6..633ee15d 100644
--- a/html/node.go
+++ b/html/node.go
@@ -177,7 +177,7 @@ func (s *nodeStack) index(n *Node) int {
 // contains returns whether a is within s.
 func (s *nodeStack) contains(a atom.Atom) bool {
 	for _, n := range *s {
-		if n.DataAtom == a {
+		if n.DataAtom == a && n.Namespace == "" {
 			return true
 		}
 	}
diff --git a/html/testdata/go/template.dat b/html/testdata/go/template.dat
index 98481b9e..ceaf0229 100644
--- a/html/testdata/go/template.dat
+++ b/html/testdata/go/template.dat
@@ -35,3 +35,28 @@
 |         <math mo>
 |           <template>
 |             content
+
+#data
+<svg><template><desc><t><svg></template>
+#errors
+#document
+| <html>
+|   <head>
+|   <body>
+|     <svg svg>
+|       <svg template>
+|         <svg desc>
+|           <t>
+|             <svg svg>
+
+#data
+<math><template><mn><b></template>
+#errors
+#document
+| <html>
+|   <head>
+|   <body>
+|     <math math>
+|       <math template>
+|         <math mn>
+|           <b>