Skip to content

Commit 031d161

Browse files
committed
Fix null pointer dereference in parse_selector_schema (#2372)
Spec sass/sass-spec#1107
1 parent 309f0d9 commit 031d161

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/parser.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -558,12 +558,13 @@ namespace Sass {
558558
schema->append(str);
559559
}
560560

561-
// check if the interpolation only contains white-space (error out)
562-
if (peek < sequence < optional_spaces, exactly<rbrace> > >(p+2)) { position = p+2;
563-
css_error("Invalid CSS", " after ", ": expected expression (e.g. 1px, bold), was ");
564-
}
565561
// skip over all nested inner interpolations up to our own delimiter
566562
const char* j = skip_over_scopes< exactly<hash_lbrace>, exactly<rbrace> >(p + 2, end_of_selector);
563+
// check if the interpolation never ends of only contains white-space (error out)
564+
if (!j || peek < sequence < optional_spaces, exactly<rbrace> > >(p+2)) {
565+
position = p+2;
566+
css_error("Invalid CSS", " after ", ": expected expression (e.g. 1px, bold), was ");
567+
}
567568
// pass inner expression to the parser to resolve nested interpolations
568569
pstate.add(p, p+2);
569570
Expression_Obj interpolant = Parser::from_c_str(p+2, j, ctx, pstate).parse_list();

0 commit comments

Comments
 (0)