File tree Expand file tree Collapse file tree 3 files changed +8
-0
lines changed Expand file tree Collapse file tree 3 files changed +8
-0
lines changed Original file line number Diff line number Diff line change 3
3
namespace Sass {
4
4
namespace Constants {
5
5
6
+ extern const unsigned long MaxCallStack = 1024 ;
7
+
6
8
// https://github.com/sass/libsass/issues/592
7
9
// https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity
8
10
// https://github.com/sass/sass/issues/1495#issuecomment-61189114
Original file line number Diff line number Diff line change 4
4
namespace Sass {
5
5
namespace Constants {
6
6
7
+ // The maximum call stack that can be created
8
+ extern const unsigned long MaxCallStack;
9
+
7
10
// https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity
8
11
// The following list of selectors is by increasing specificity:
9
12
extern const unsigned long Specificity_Star;
Original file line number Diff line number Diff line change @@ -527,6 +527,9 @@ namespace Sass {
527
527
528
528
Expression* Eval::operator ()(Function_Call* c)
529
529
{
530
+ if (backtrace->parent != NULL && backtrace->depth () > Constants::MaxCallStack) {
531
+ error (" Stack depth exceeded max of " + to_string (Constants::MaxCallStack), c->pstate (), backtrace);
532
+ }
530
533
string name (Util::normalize_underscores (c->name ()));
531
534
string full_name (name + " [f]" );
532
535
Arguments* args = c->arguments ();
You can’t perform that action at this time.
0 commit comments