Skip to content

Commit

Permalink
Fix some null pointer access crashes
Browse files Browse the repository at this point in the history
Fixes #3063
Fixes #3035
  • Loading branch information
mgreter committed May 1, 2020
1 parent 49753ba commit 8bd6093
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 8bd6093

Please sign in to comment.