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

crash on invalid input when compiled with Visual Studio #1443

Closed
hmoffatt opened this issue Aug 13, 2015 · 8 comments · Fixed by #1446 or #1449
Closed

crash on invalid input when compiled with Visual Studio #1443

hmoffatt opened this issue Aug 13, 2015 · 8 comments · Fixed by #1446 or #1449

Comments

@hmoffatt
Copy link

When I compile libsass + sassc with Visual Studio 2013 (using the vcxproj included with libsass), and the input CSS source contains errors, sassc is crashing.

My input is simply:
foo { color: rgba(10,10,10,10); }

First an exception is thrown at error_handling.cpp:36, but immediately after this there is an invalid pointer operation in memory_manager.cpp:70 (Memory_Manager::destroy, deleting np).

sassc.exe!Sass::Memory_Manager<Sass::AST_Node>::destroy(Sass::AST_Node * np=0x004bac98) Line 70 C++
sassc.exe!operator delete<Sass::AST_Node>(void * np=0x004bac98, Sass::Memory_Manager<Sass::AST_Node> & mem={...}) Line 38   C++
sassc.exe!_GetSystemTimeAsFileTime@4�() C++
sassc.exe!Sass::Eval::operator()(Sass::Function_Call * c=0x0049b348) Line 644   C++
sassc.exe!Sass::Function_Call::perform(Sass::Operation<Sass::Expression *> * op=0x0038f128) Line 1084   C++
sassc.exe!Sass::Expand::operator()(Sass::Declaration * d=0x0049a9e8) Line 207   C++
sassc.exe!Sass::Declaration::perform(Sass::Operation<Sass::Statement *> * op=0x0038f120) Line 497   C++
sassc.exe!Sass::Expand::append_block(Sass::Block * b=0x0049a758) Line 587   C++
sassc.exe!Sass::Expand::operator()(Sass::Block * b=0x0049a758) Line 79  C++
sassc.exe!Sass::Block::perform(Sass::Operation<Sass::Statement *> * op=0x0038f120) Line 362 C++
sassc.exe!Sass::Expand::operator()(Sass::Ruleset * r=0x00498458) Line 104   C++
sassc.exe!Sass::Ruleset::perform(Sass::Operation<Sass::Statement *> * op=0x0038f120) Line 392   C++
sassc.exe!Sass::Expand::append_block(Sass::Block * b=0x00498290) Line 587   C++
sassc.exe!Sass::Expand::operator()(Sass::Block * b=0x00498290) Line 79  C++
sassc.exe!Sass::Block::perform(Sass::Operation<Sass::Statement *> * op=0x0038f120) Line 362 C++
sassc.exe!Sass::Context::parse_file() Line 324  C++
sassc.exe!sass_parse_block(Sass_Compiler * compiler=0x00499c70) Line 504    C++
sassc.exe!sass_compiler_parse(Sass_Compiler * compiler=0x00499c70) Line 655 C++
sassc.exe!sass_compile_context(Sass_Context * c_ctx=0x00497838, Sass::Context::Data cpp_opt={...}) Line 537 C++
sassc.exe!sass_compile_file_context(Sass_File_Context * file_ctx=0x00497838) Line 642   C++
sassc.exe!compile_file(Sass_Options * options=0x00497428, char * input_path=0x0048b897, char * outfile=0x00000000) Line 108 C
sassc.exe!main(int argc=2, char * * argv=0x0048b858) Line 284   C
sassc.exe!__tmainCRTStartup() Line 626  C
sassc.exe!mainCRTStartup() Line 466 C
kernel32.dll!@BaseThreadInitThunk@12�() Unknown
ntdll.dll!___RtlUserThreadStart@8�()    Unknown
ntdll.dll!__RtlUserThreadStart@8�() Unknown
@xzyfer
Copy link
Contributor

xzyfer commented Aug 13, 2015

Which versions of libsass and sassc are you compiling?

@xzyfer
Copy link
Contributor

xzyfer commented Aug 13, 2015

I am able to reproduce this on master.

@xzyfer
Copy link
Contributor

xzyfer commented Aug 13, 2015

This appears to a regression in 222d8c0

@xzyfer
Copy link
Contributor

xzyfer commented Aug 13, 2015

I can confirm reverting 222d8c0 fixes the issue. Do have a time to take a look @mgreter? I can't see the issue but I'm not feeling the greatest atm.

As as aside we shouldn't be throwing an error here, but removing the error doesn't fix the real issue.

@am11
Copy link
Contributor

am11 commented Aug 15, 2015

PR URL: /pull/1446.
Test Spec URL: sass/sass-spec/pull/472.

Verified on Ubuntu Server 14 (Clang 3.6) and Windows 10 (VS 2015).

am11 referenced this issue Aug 16, 2015
This is to conform with ruby-sass behavior.
@xzyfer xzyfer self-assigned this Aug 17, 2015
@mgreter
Copy link
Contributor

mgreter commented Aug 17, 2015

The actual problem was ARGR("$alpha", Number, 0, 1)->value() IMHO. We need to check the returned value first (in this case ARGR does not seem to return anything).

@technoAri
Copy link

I can't understand how to contribute... can u help me?????

On 17 August 2015 at 23:53, Marcel Greter [email protected] wrote:

The actual problem was ARGR("$alpha", Number, 0, 1)->value() IMHO. We
need to check the returned value first (in this case ARGR does not seem to
return anything).


Reply to this email directly or view it on GitHub
#1443 (comment).

@mgreter
Copy link
Contributor

mgreter commented Aug 17, 2015

Was just documenting what the actual culprit was, nothing you have to do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants