Skip to content

Commit

Permalink
Bugfix: zero length vendor at rules
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed May 15, 2015
1 parent 4a33f4b commit e0bf2d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion css/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (p *Parser) parseAtRule() GrammarType {
atRuleName := p.data
if len(atRuleName) > 0 && atRuleName[1] == '-' {
if i := bytes.IndexByte(atRuleName[2:], '-'); i != -1 {
atRuleName = atRuleName[i+3:] // skip vendor specific prefix
atRuleName = atRuleName[i+2:] // skip vendor specific prefix
}
}
atRule := ToHash(atRuleName[1:])
Expand Down
3 changes: 3 additions & 0 deletions css/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ func TestParser(t *testing.T) {
assertParse(t, true, ".class [c=y]{}", ".class [c=y]{}") // tdewolff/minify#16
assertParse(t, true, "table{font-family:Verdana}", "table{font-family:Verdana;}") // tdewolff/minify#22

// go-fuzz
assertParse(t, true, "@-webkit-", "@-webkit-;")

assert.Equal(t, "Error", ErrorGrammar.String())
assert.Equal(t, "AtRule", AtRuleGrammar.String())
assert.Equal(t, "BeginAtRule", BeginAtRuleGrammar.String())
Expand Down

0 comments on commit e0bf2d7

Please sign in to comment.