Skip to content

Commit

Permalink
Check attributes not null
Browse files Browse the repository at this point in the history
  • Loading branch information
jhy committed Oct 18, 2023
1 parent d61ec5a commit 4864af4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/jsoup/parser/HtmlTreeBuilderState.java
Original file line number Diff line number Diff line change
Expand Up @@ -1775,9 +1775,9 @@ else if (HtmlTreeBuilderState.isWhitespace(c))
if (StringUtil.in(start.normalName, InForeignToHtml))
return processAsHtml(t, tb);
if (start.normalName.equals("font") && (
start.attributes.hasKeyIgnoreCase("color")
|| start.attributes.hasKeyIgnoreCase("face")
|| start.attributes.hasKeyIgnoreCase("size")))
start.hasAttributeIgnoreCase("color")
|| start.hasAttributeIgnoreCase("face")
|| start.hasAttributeIgnoreCase("size")))
return processAsHtml(t, tb);

// Any other start:
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/org/jsoup/parser/Token.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,15 @@ final boolean hasAttributes() {
return attributes != null;
}

/** Case-sensitive check */
final boolean hasAttribute(String key) {
return attributes != null && attributes.hasKey(key);
}

final boolean hasAttributeIgnoreCase(String key) {
return attributes != null && attributes.hasKeyIgnoreCase(key);
}

final void finaliseTag() {
// finalises for emit
if (hasAttrName) {
Expand Down
Binary file added src/test/resources/fuzztests/63259.html.gz
Binary file not shown.

0 comments on commit 4864af4

Please sign in to comment.