Skip to content

Commit

Permalink
Merge pull request #3090 from mgreter/bugfix/fuzzy-crashes
Browse files Browse the repository at this point in the history
Fix some null pointer access crashes
  • Loading branch information
mgreter committed May 1, 2020
2 parents 49753ba + 8bd6093 commit 8d312a1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/cssize.cpp
Expand Up @@ -380,7 +380,7 @@ namespace Sass {

bool Cssize::bubblable(Statement* s)
{
return Cast<StyleRule>(s) || s->bubbles();
return Cast<StyleRule>(s) || (s && s->bubbles());
}

Block* Cssize::flatten(const Block* b)
Expand Down Expand Up @@ -479,7 +479,8 @@ namespace Sass {
children->pstate(),
children->length(),
children->is_root());
bb->append(ss->perform(this));
auto evaled = ss->perform(this);
if (evaled) bb->append(evaled);

Block_Obj wrapper_block = SASS_MEMORY_NEW(Block,
children->pstate(),
Expand Down
1 change: 1 addition & 0 deletions src/extender.cpp
Expand Up @@ -147,6 +147,7 @@ namespace Sass {
for (auto target : extensions) {
SimpleSelector* key = target.first;
ExtSelExtMapEntry& val = target.second;
if (val.empty()) continue;
if (originals.find(key) == originals.end()) {
const Extension& extension = val.front().second;
if (extension.isOptional) continue;
Expand Down
2 changes: 2 additions & 0 deletions src/memory/memory_pool.hpp
Expand Up @@ -55,7 +55,9 @@ namespace Sass {
std::vector<void*> arenas;

// One pointer for every bucket (zero init)
#ifdef _MSC_VER
#pragma warning (suppress:4351)
#endif
void* freeList[SassAllocatorBuckets]{};

// Increase the address until it sits on a
Expand Down
2 changes: 1 addition & 1 deletion src/output.cpp
Expand Up @@ -289,7 +289,7 @@ namespace Sass {

for (size_t i = 0, L = b->length(); i < L; ++i) {
Statement_Obj stm = b->get(i);
stm->perform(this);
if (stm) stm->perform(this);
if (i < L - 1 && format) append_special_linefeed();
}

Expand Down

0 comments on commit 8d312a1

Please sign in to comment.