Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on float with leading sign but with no decimal #1856

Closed
connorskees opened this issue Dec 23, 2022 · 5 comments · Fixed by #1865
Closed

Crash on float with leading sign but with no decimal #1856

connorskees opened this issue Dec 23, 2022 · 5 comments · Fixed by #1865
Assignees

Comments

@connorskees
Copy link
Contributor

dart-sass will crash on the following input:

a {
    color: +.;
}
a {
    color: -.;
}
Stacktrace
Unexpected exception:
FormatException: Invalid double
+


dart:core                                                double.parse
package:sass/src/parse/stylesheet.dart 2543              StylesheetParser._number
package:sass/src/parse/stylesheet.dart 2473              StylesheetParser._plusExpression
package:sass/src/parse/stylesheet.dart 2221              StylesheetParser._singleExpression
package:sass/src/parse/stylesheet.dart 1754              StylesheetParser._expression
package:sass/src/parse/stylesheet.dart 406               StylesheetParser._declarationOrBuffer
package:sass/src/parse/stylesheet.dart 322               StylesheetParser._declarationOrStyleRule
package:sass/src/parse/stylesheet.dart 189               StylesheetParser._statement
package:sass/src/parse/scss.dart 99                      ScssParser.children
package:sass/src/parse/stylesheet.dart 3906              StylesheetParser._withChildren
package:sass/src/parse/stylesheet.dart 490               StylesheetParser._styleRule
package:sass/src/parse/stylesheet.dart 275               StylesheetParser._variableDeclarationOrStyleRule
package:sass/src/parse/stylesheet.dart 190               StylesheetParser._statement
package:sass/src/parse/stylesheet.dart 91                StylesheetParser.parse.<fn>.<fn>
package:sass/src/parse/scss.dart 137                     ScssParser.statements
package:sass/src/parse/stylesheet.dart 82                StylesheetParser.parse.<fn>
package:sass/src/parse/parser.dart 713                   Parser.wrapSpanFormatException
package:sass/src/parse/stylesheet.dart 78                StylesheetParser.parse
package:sass/src/ast/sass/statement/stylesheet.dart 107  new Stylesheet.parseScss
package:sass/src/ast/sass/statement/stylesheet.dart 83   new Stylesheet.parse
package:sass/src/import_cache.dart 206                   ImportCache.importCanonical.<fn>
dart:collection                                          _LinkedHashMapMixin.putIfAbsent
package:sass/src/import_cache.dart 201                   ImportCache.importCanonical
package:sass/src/compile.dart 59                         compile
package:sass/src/executable/compile_stylesheet.dart 97   compileStylesheet
d:\a\dart-sass\dart-sass\bin\sass.dart 65                main
nex3 added a commit that referenced this issue Jan 5, 2023
nex3 added a commit to sass/sass-spec that referenced this issue Jan 5, 2023
@nex3 nex3 closed this as completed in #1865 Jan 5, 2023
nex3 added a commit that referenced this issue Jan 5, 2023
@nex3
Copy link
Contributor

nex3 commented Jan 17, 2023

Apparently this is still an issue.

@nex3 nex3 reopened this Jan 17, 2023
@nex3
Copy link
Contributor

nex3 commented Jan 18, 2023

I went to add more tests for this, and the cases @stof mentioned (+1. and -1.) both throw useful errors as expected, so I'm going to close this back out pending a reproduction.

@nex3 nex3 closed this as completed Jan 18, 2023
@connorskees
Copy link
Contributor Author

connorskees commented Jan 18, 2023

I believe the issue as described by @stof is not that the inputs cause a crash, but rather that they now are no longer parsed as valid numbers.

@nex3
Copy link
Contributor

nex3 commented Jan 18, 2023

I don't think they were ever parsed as valid numbers (I just tested on 1.57.1). Certainly per spec they oughtn't.

@connorskees
Copy link
Contributor Author

Ah. Testing with sassmeister, you're right -- they've never been accepted as valid numbers. In which case I think there's no issue with #1865.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants