Skip to content

Commit 8d312a1

Browse files
authored
Merge pull request #3090 from mgreter/bugfix/fuzzy-crashes
Fix some null pointer access crashes
2 parents 49753ba + 8bd6093 commit 8d312a1

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

src/cssize.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ namespace Sass {
380380

381381
bool Cssize::bubblable(Statement* s)
382382
{
383-
return Cast<StyleRule>(s) || s->bubbles();
383+
return Cast<StyleRule>(s) || (s && s->bubbles());
384384
}
385385

386386
Block* Cssize::flatten(const Block* b)
@@ -479,7 +479,8 @@ namespace Sass {
479479
children->pstate(),
480480
children->length(),
481481
children->is_root());
482-
bb->append(ss->perform(this));
482+
auto evaled = ss->perform(this);
483+
if (evaled) bb->append(evaled);
483484

484485
Block_Obj wrapper_block = SASS_MEMORY_NEW(Block,
485486
children->pstate(),

src/extender.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ namespace Sass {
147147
for (auto target : extensions) {
148148
SimpleSelector* key = target.first;
149149
ExtSelExtMapEntry& val = target.second;
150+
if (val.empty()) continue;
150151
if (originals.find(key) == originals.end()) {
151152
const Extension& extension = val.front().second;
152153
if (extension.isOptional) continue;

src/memory/memory_pool.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ namespace Sass {
5555
std::vector<void*> arenas;
5656

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

6163
// Increase the address until it sits on a

src/output.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ namespace Sass {
289289

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

0 commit comments

Comments
 (0)