Don't crash when parsing +. (#1865)

Closes #1856
This commit is contained in:
Natalie Weizenbaum 2023-01-04 17:03:08 -08:00 committed by GitHub
parent aceb1e8c51
commit 14c1634057
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View File

@ -3,6 +3,9 @@
* Remove sourcemap comments from Sass sources. The generated sourcemap comment
for the compiled CSS output remains unaffected.
* Produce a better error message for a number with a leading `+` or `-`, a
decimal point, but no digits.
## 1.57.1
* No user-visible changes.

View File

@ -2529,7 +2529,10 @@ abstract class StylesheetParser extends Parser {
// Don't complain about a dot after a number unless the number starts with a
// dot. We don't allow a plain ".", but we need to allow "1." so that
// "1..." will work as a rest argument.
_tryDecimal(allowTrailingDot: scanner.position != start.position);
_tryDecimal(
allowTrailingDot: scanner.position != start.position &&
first != $plus &&
first != $minus);
_tryExponent();
// Use Dart's built-in double parsing so that we don't accumulate

View File

@ -1,5 +1,5 @@
name: sass
version: 1.57.2
version: 1.57.2-dev
description: A Sass implementation in Dart.
homepage: https://github.com/sass/dart-sass