Skip to content

Commit

Permalink
Don't crash when parsing +.
Browse files Browse the repository at this point in the history
Closes #1856
  • Loading branch information
nex3 committed Jan 5, 2023
1 parent 5522c17 commit b363e8e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.57.2

* 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.
Expand Down
5 changes: 4 additions & 1 deletion lib/src/parse/stylesheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2534,7 +2534,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
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: sass
version: 1.57.1
version: 1.57.2-dev
description: A Sass implementation in Dart.
homepage: https://github.com/sass/dart-sass

Expand Down

0 comments on commit b363e8e

Please sign in to comment.