Skip to content

Commit e0bf2d7

Browse files
committed
Bugfix: zero length vendor at rules
1 parent 4a33f4b commit e0bf2d7

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

css/parse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func (p *Parser) parseAtRule() GrammarType {
196196
atRuleName := p.data
197197
if len(atRuleName) > 0 && atRuleName[1] == '-' {
198198
if i := bytes.IndexByte(atRuleName[2:], '-'); i != -1 {
199-
atRuleName = atRuleName[i+3:] // skip vendor specific prefix
199+
atRuleName = atRuleName[i+2:] // skip vendor specific prefix
200200
}
201201
}
202202
atRule := ToHash(atRuleName[1:])

css/parse_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ func TestParser(t *testing.T) {
129129
assertParse(t, true, ".class [c=y]{}", ".class [c=y]{}") // tdewolff/minify#16
130130
assertParse(t, true, "table{font-family:Verdana}", "table{font-family:Verdana;}") // tdewolff/minify#22
131131

132+
// go-fuzz
133+
assertParse(t, true, "@-webkit-", "@-webkit-;")
134+
132135
assert.Equal(t, "Error", ErrorGrammar.String())
133136
assert.Equal(t, "AtRule", AtRuleGrammar.String())
134137
assert.Equal(t, "BeginAtRule", BeginAtRuleGrammar.String())

0 commit comments

Comments
 (0)