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

AddressSanitizer: null pointer dereference (SEGV) in Sass::Expand::operator (libsass/src/expand.cpp:249:28) #2664

Closed
glen-mac opened this issue Jun 3, 2018 · 1 comment

Comments

@glen-mac
Copy link

glen-mac commented Jun 3, 2018

Hey there, I have discovered a null pointer dereference in libsass at: expand.cpp:249:28

Found when fuzzing commit 60f8391 of libsass, using commit aa6d5c6 of sassc as a harness.

Compile flags to reproduce:

CC=clang CXX=clang++ CFLAGS='-fsanitize=address -g -O2 -fno-omit-frame-pointer' CXXFLAGS=$CFLAGS make -C sassc -j8

System information:

$ uname -a
Linux s127422 3.13.0-137-generic #186-Ubuntu SMP Mon Dec 4 19:09:19 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

This bug was found to be in libsass releases from 3.5.0 through to 3.5.2 and then re-introduced in the commit 60f8391.

You can find a collection of PoC files that trigger the bug here.

The full ASAN report is shown below:

↳ ./sassc.bin < crash.file
ASAN:DEADLYSIGNAL
=================================================================
==6006==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x00000071bb37 bp 0x7ffee8b515d0 sp 0x7ffee8b51140 T0)
    #0 0x71bb36 in Sass::Expand::operator()(Sass::Declaration*) /home/glenn/temp/libsass/src/expand.cpp:258:28
    #1 0x731326 in Sass::Expand::append_block(Sass::Block*) /home/glenn/temp/libsass/src/expand.cpp:808:27
    #2 0x714f0a in Sass::Expand::operator()(Sass::Block*) /home/glenn/temp/libsass/src/expand.cpp:81:5
    #3 0x717116 in Sass::Expand::operator()(Sass::Ruleset*) /home/glenn/temp/libsass/src/expand.cpp:153:27
    #4 0x731326 in Sass::Expand::append_block(Sass::Block*) /home/glenn/temp/libsass/src/expand.cpp:808:27
    #5 0x714f0a in Sass::Expand::operator()(Sass::Block*) /home/glenn/temp/libsass/src/expand.cpp:81:5
    #6 0x5521f7 in Sass::Context::compile() /home/glenn/temp/libsass/src/context.cpp:659:12
    #7 0x55144c in Sass::Data_Context::parse() /home/glenn/temp/libsass/src/context.cpp:630:12
    #8 0x5200ca in Sass::sass_parse_block(Sass_Compiler*) /home/glenn/temp/libsass/src/sass_context.cpp:238:22
    #9 0x5200ca in sass_compiler_parse /home/glenn/temp/libsass/src/sass_context.cpp:487
    #10 0x51f6d9 in sass_compile_context(Sass_Context*, Sass::Context*) /home/glenn/temp/libsass/src/sass_context.cpp:375:7
    #11 0x51707d in compile_stdin /home/glenn/temp/findsass/sassc/sassc.c:138:5
    #12 0x517a8e in main /home/glenn/temp/findsass/sassc/sassc.c:375:18
    #13 0x7f6ce042a82f in __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:291
    #14 0x4456d8 in _start (/home/glenn/temp/findsass/sassc.bin+0x4456d8)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/glenn/temp/libsass/src/expand.cpp:258:28 in Sass::Expand::operator()(Sass::Declaration*)
==6006==ABORTING
@glen-mac glen-mac changed the title AddressSanitizer: null pointer dereference (SEGV) in Sass::Functions::selector_append (libsass/src/expand.cpp:249:28) AddressSanitizer: null pointer dereference (SEGV) in Sass::Expand::operator (libsass/src/expand.cpp:249:28) Jun 3, 2018
@xzyfer
Copy link
Contributor

xzyfer commented Jul 4, 2018

Fixed in 0bc35e3.

Thanks.

@xzyfer xzyfer closed this as completed Jul 4, 2018
@glebm glebm added the Fuzzy label Apr 15, 2019
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