Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some null pointer access crashes #3090

Merged
merged 1 commit into from
May 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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