Skip to content

Fix for #33: null in attribute value #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions html5lib/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def rcdataState(self):
# have already been appended to lastFourChars and will have broken
# any <!-- or --> sequences
else:
chars = self.stream.charsUntil(("&", "<"))
chars = self.stream.charsUntil(("&", "<", "\u0000"))
self.tokenQueue.append({"type": tokenTypes["Characters"], "data":
data + chars})
return True
Expand Down Expand Up @@ -1016,7 +1016,7 @@ def attributeValueDoubleQuotedState(self):
self.state = self.dataState
else:
self.currentToken["data"][-1][1] += data +\
self.stream.charsUntil(("\"", "&"))
self.stream.charsUntil(("\"", "&", "\u0000"))
return True

def attributeValueSingleQuotedState(self):
Expand All @@ -1035,7 +1035,7 @@ def attributeValueSingleQuotedState(self):
self.state = self.dataState
else:
self.currentToken["data"][-1][1] += data +\
self.stream.charsUntil(("'", "&"))
self.stream.charsUntil(("'", "&", "\u0000"))
return True

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

def afterAttributeValueState(self):
Expand Down