Skip to content

Commit

Permalink
Fix heap-buffer-overflow in prelexer.hpp:70 (#2857)
Browse files Browse the repository at this point in the history
Fixes #2814
  • Loading branch information
glebm authored and xzyfer committed Apr 5, 2019
1 parent d382603 commit 8e681e2
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/prelexer.hpp
Expand Up @@ -65,16 +65,15 @@ namespace Sass {
size_t level = 0;
bool in_squote = false;
bool in_dquote = false;
// bool in_braces = false;

while (*src) {

// check for abort condition
if (end && src >= end) break;
bool in_backslash_escape = false;

while ((end == nullptr || src < end) && *src != '\0') {
// has escaped sequence?
if (*src == '\\') {
++ src; // skip this (and next)
if (in_backslash_escape) {
in_backslash_escape = false;
}
else if (*src == '\\') {
in_backslash_escape = true;
}
else if (*src == '"') {
in_dquote = ! in_dquote;
Expand Down Expand Up @@ -120,7 +119,7 @@ namespace Sass {
// first start/opener must be consumed already!
template<prelexer start, prelexer stop>
const char* skip_over_scopes(const char* src) {
return skip_over_scopes<start, stop>(src, 0);
return skip_over_scopes<start, stop>(src, nullptr);
}

// Match a sequence of characters delimited by the supplied chars.
Expand Down

0 comments on commit 8e681e2

Please sign in to comment.