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

3.3.3 Regression: Segfaults using @extend with unknown selector #1916

Closed
irundaia opened this issue Feb 14, 2016 · 2 comments
Closed

3.3.3 Regression: Segfaults using @extend with unknown selector #1916

irundaia opened this issue Feb 14, 2016 · 2 comments

Comments

@irundaia
Copy link

There seems to be an issue with unfound selectors when using @extend. A segfault occurs when entering a selector which cannot be found elsewhere in the code. For example:

.z-depth-1 {
  box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
}

.z-depth-1-half {
  box-shadow: 0 5px 11px 0 rgba(0, 0, 0, 0.18), 0 4px 15px 0 rgba(0, 0, 0, 0.15);
}

.btn {
  @extend .z-depth-1;

  &:hover {
    @extend .z-depth-half-1;
  }
}

While I think that it should report an error (even though ruby sass does not) currently, anything using libsass 3.3.3 crashes with a segfault. Using libsass 3.3.2 it will be compiled into:

.z-depth-1, .btn {
    box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
}

.z-depth-1-half {
    box-shadow: 0 5px 11px 0 rgba(0, 0, 0, 0.18), 0 4px 15px 0 rgba(0, 0, 0, 0.15);
}
@saper
Copy link
Member

saper commented Feb 14, 2016

Confirmed using

/home/saper/sw/sassc/bin/sassc --version
sassc: 3.3.0
libsass: 3.3.3-2-g20bfd
sass2scss: 1.0.5

Test added sass/sass-spec#728

@saper
Copy link
Member

saper commented Feb 14, 2016

We actually crash trying to write the error message about it being undefined.

Stacktrace, sel is NULL:

Program received signal SIGSEGV, Segmentation fault.
0x000000000055f7d5 in Sass::Extend::operator() (this=0x7fffffffda90, b=0x8020558c0) at src/extend.cpp:2042
2042            std::string str_sel(sel->to_string({ NESTED, 5 }));
(gdb) bt
#0  0x000000000055f7d5 in Sass::Extend::operator() (this=0x7fffffffda90, b=0x8020558c0)
    at src/extend.cpp:2042
#1  0x00000000004ee79e in Sass::Block::perform (this=0x8020558c0, op=0x7fffffffda90) at src/ast.hpp:425
#2  0x00000000004afc42 in Sass::Context::compile (this=0x802024280) at src/context.cpp:660
#3  0x00000000004ae99e in Sass::File_Context::parse (this=0x802024280) at src/context.cpp:583
#4  0x0000000000422857 in sass_parse_block (compiler=0x80201a060) at src/sass_context.cpp:321
#5  0x0000000000422681 in sass_compiler_parse (compiler=0x80201a060) at src/sass_context.cpp:467
#6  0x0000000000422305 in sass_compile_context (c_ctx=0x80201f100, cpp_ctx=0x802024280)
    at src/sass_context.cpp:356
#7  0x000000000042256c in sass_compile_file_context (file_ctx=0x80201f100) at src/sass_context.cpp:454
#8  0x000000000041b13f in compile_file (options=0x80201c080, input_path=0x7fffffffea7f "input.scss", 
    outfile=0x0) at sassc.c:131
#9  0x000000000041b945 in main (argc=<optimized out>, argv=<optimized out>) at sassc.c:332

@saper saper added this to the 3.3.4 milestone Feb 14, 2016
@mgreter mgreter self-assigned this Feb 23, 2016
xzyfer added a commit to xzyfer/sass-spec that referenced this issue Mar 17, 2016
xzyfer pushed a commit to xzyfer/libsass that referenced this issue Mar 17, 2016
xzyfer added a commit to xzyfer/sass-spec that referenced this issue Mar 17, 2016
xzyfer pushed a commit to xzyfer/libsass that referenced this issue Mar 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants