Skip to content

Lax argument validation cause crash with some at-rules #47

@rubycon

Description

@rubycon

When processing at-rules, postcss-functions expect the node to have a "params" entry but not all at-rules have params. So node.params can be undefined and cause an error when passed to postcss-value-parser.

export function transformAtRule(node, functions) {
return then(transformString(node.params, functions), value => {
node.params = value;
});
}

The transformString() function should check if a proper string is supplied and fallback to an empty string or avoid parsing if not.

I never had any troubles with PostCSS and font-face rules before. I only notice this bug after a recent update. Apparently my occurrence of the bug is triggered by postcss-font-magician which inject its own at-rules with no params entry (which is not a bug).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions