Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Fix out of boundary vector access
Browse files Browse the repository at this point in the history
  • Loading branch information
mgreter committed Nov 2, 2019
1 parent d2390e5 commit 994695c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/parser_selectors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,12 @@ namespace Sass {
// parent selector only allowed at start
// upcoming Sass may allow also trailing
ParserState state(pstate);
SimpleSelectorObj prev = (*seq)[seq->length()-1];
std::string sel(prev->to_string({ NESTED, 5 }));
std::string found("&");
if (lex < identifier >()) { found += std::string(lexed); }
if (lex < identifier >()) {
found += std::string(lexed);
}
std::string sel(seq->hasRealParent() ? "&" : "");
if (!seq->empty()) { sel = seq->last()->to_string({ NESTED, 5 }); }
// ToDo: parser should throw parser exceptions
error("Invalid CSS after \"" + sel + "\": expected \"{\", was \"" + found + "\"\n\n"
"\"" + found + "\" may only be used at the beginning of a compound selector.", state);
Expand Down

0 comments on commit 994695c

Please sign in to comment.