You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug was observed with libsass 3.5.4 (node-sass 4.13.1)
NPM version: 6.13.4
Node version: v12.16.1
Node Process:
node: '12.16.1',
v8: '7.8.279.23-node.31',
uv: '1.34.0',
zlib: '1.2.11',
brotli: '1.0.7',
ares: '1.15.0',
modules: '72',
nghttp2: '1.40.0',
napi: '5',
llhttp: '2.0.4',
http_parser: '2.9.3',
openssl: '1.1.1d',
cldr: '35.1',
icu: '64.2',
tz: '2019c',
unicode: '12.1'
Node Platform: linux
Node architecture: x64
node-sass version:
node-sass 4.13.1 (Wrapper) [JavaScript]
libsass 3.5.4 (Sass Compiler) [C/C++]
npm node-sass versions:
my-web-app@0.1.0 /path/
└── node-sass@4.13.1
Bug Description:
Running node-sass to compile the following code results in a segmentation fault in Ubuntu. In particular, the fault seems to be caused by trying to access a variable obtained using an @each statement to destructure a list of lists when the inner-list does not have enough elements to assign to all destructured variables.
The expected behavior of the SASS compiler (based on official documentation) when there aren't enough elements in the list is to simply assign null to any remaining variables in the @each statement.
Note that the segfault only seems to occur when the @each is inside a function. This is demonstrated by the debug output of the code below -- the @each statement in the root scope works as expected with no error. However, when the test function is called, the @each statement inside it destructures the variables $a and $b correctly (and these can be output correctly by @debug), but when attempt is made to access $c (for which there is no corresponding element in the list), the segfault occurs.
SCSS code:
@debug"Works fine outside a function.";
@each$a, $b, $cin (A B,) {
@debug a $a;
@debug b $b;
@debug c $c;
}
@functiontest1() {
@each$a, $b, $cin (A B,) {
@debug a $a;
@debug b $b;
@debug c $c;
}
@return0;
}
@debug"Segfault happens in function call.";
$var: test1();
Output of node-sass compilation:
stdin:1 DEBUG: Works fine outside a function.
stdin:3 DEBUG: a A
stdin:4 DEBUG: b B
stdin:5 DEBUG: c null
stdin:16 DEBUG: Segfault happens infunctioncall.
stdin:10 DEBUG: a A
stdin:11 DEBUG: b B
Segmentation fault (core dumped)
I originally had this problem in Ubuntu running on WSL so I thought it might be a WSL issue, but I have reproduced the same bug on a "real" Ubuntu 16.04.6 LTS.
I installed node-sass (at project-level, not globally) with yarn 1.22.1 and am running it with cat FILE | npx node-sass.
The text was updated successfully, but these errors were encountered:
richworx
changed the title
Segmentation Fault with @each on WSL
Segmentation Fault destructuring with @each
Mar 30, 2020
@nschonni Are you sure this is specifically Libsass and not anything to do with node?
I also want to note that I have been able to reproduce this on different versions of node (e.g. v10.18.0) and different operating systems. I would be surprised if others have not already observed it.
Fixessass#3078
It seems the ternary is returning the type of the second argument.
This means that the first one was first upgraded to a shared object,
and once assigned to a normal pointer, it got prematurely collected.
This bug was observed with libsass 3.5.4 (node-sass 4.13.1)
└── node-sass@4.13.1
Bug Description:
Running node-sass to compile the following code results in a segmentation fault in Ubuntu. In particular, the fault seems to be caused by trying to access a variable obtained using an
@each
statement to destructure a list of lists when the inner-list does not have enough elements to assign to all destructured variables.The expected behavior of the SASS compiler (based on official documentation) when there aren't enough elements in the list is to simply assign null to any remaining variables in the
@each
statement.Note that the segfault only seems to occur when the
@each
is inside a function. This is demonstrated by the debug output of the code below -- the@each
statement in the root scope works as expected with no error. However, when thetest
function is called, the@each
statement inside it destructures the variables$a
and$b
correctly (and these can be output correctly by@debug
), but when attempt is made to access$c
(for which there is no corresponding element in the list), the segfault occurs.SCSS code:
Output of node-sass compilation:
I originally had this problem in Ubuntu running on WSL so I thought it might be a WSL issue, but I have reproduced the same bug on a "real" Ubuntu 16.04.6 LTS.
I installed node-sass (at project-level, not globally) with yarn 1.22.1 and am running it with
cat FILE | npx node-sass
.The text was updated successfully, but these errors were encountered: