Skip to content

Commit d0b9b13

Browse files
valievkarimgsnedders
authored andcommitted
Fix for html5lib#33: null in attribute value breaks XML AttValue
In several places we were only checking for null in the state's if-statement and not breaking out of charsUntil for it.
1 parent 073d792 commit d0b9b13

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

html5lib/tokenizer.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def rcdataState(self):
306306
# have already been appended to lastFourChars and will have broken
307307
# any <!-- or --> sequences
308308
else:
309-
chars = self.stream.charsUntil(("&", "<"))
309+
chars = self.stream.charsUntil(("&", "<", "\u0000"))
310310
self.tokenQueue.append({"type": tokenTypes["Characters"], "data":
311311
data + chars})
312312
return True
@@ -1016,7 +1016,7 @@ def attributeValueDoubleQuotedState(self):
10161016
self.state = self.dataState
10171017
else:
10181018
self.currentToken["data"][-1][1] += data +\
1019-
self.stream.charsUntil(("\"", "&"))
1019+
self.stream.charsUntil(("\"", "&", "\u0000"))
10201020
return True
10211021

10221022
def attributeValueSingleQuotedState(self):
@@ -1035,7 +1035,7 @@ def attributeValueSingleQuotedState(self):
10351035
self.state = self.dataState
10361036
else:
10371037
self.currentToken["data"][-1][1] += data +\
1038-
self.stream.charsUntil(("'", "&"))
1038+
self.stream.charsUntil(("'", "&", "\u0000"))
10391039
return True
10401040

10411041
def attributeValueUnQuotedState(self):
@@ -1060,7 +1060,7 @@ def attributeValueUnQuotedState(self):
10601060
self.state = self.dataState
10611061
else:
10621062
self.currentToken["data"][-1][1] += data + self.stream.charsUntil(
1063-
frozenset(("&", ">", '"', "'", "=", "<", "`")) | spaceCharacters)
1063+
frozenset(("&", ">", '"', "'", "=", "<", "`", "\u0000")) | spaceCharacters)
10641064
return True
10651065

10661066
def afterAttributeValueState(self):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy