Skip to content

Commit

Permalink
Bugfix: early string ending for selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed May 15, 2015
1 parent ebea09e commit 240df9d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion css/css.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func (c *cssMinifier) minifySelectors(property []byte, values []css.Token) error
inAttr = true
} else if inAttr && val.TokenType == css.RightBracketToken {
inAttr = false
} else if inAttr && val.TokenType == css.StringToken {
} else if inAttr && val.TokenType == css.StringToken && len(val.Data) > 2 {
s := val.Data[1 : len(val.Data)-1]
if css.IsIdent([]byte(s)) {
if _, err := c.w.Write(s); err != nil {
Expand Down
1 change: 1 addition & 0 deletions css/css_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func TestCSS(t *testing.T) {

// go-fuzz
assertCSS(t, m, false, "FONT-FAMILY: ru\"", "font-family:ru")
assertCSS(t, m, true, "input[type=\"\x00\"] { a: b\n}.a{}", "input[type=\"\x00\"] { a: b\n}.a{}")
}

////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 240df9d

Please sign in to comment.