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
SASS: RegExp buffer overflow when parsing Sencha Touch's apple.css #104
Comments
Don't know if this helps, but I get a similar error error while trying to run "compass watch" against our scss files with very long selectors, but only on Ruby 1.8.7. It seems to work fine when rvm-ing Ruby 1.9.2+. StringScanner::Error on line 906 of /Library/Ruby/Gems/1.8/gems/sass-3.1.7/lib/sass/../sass/scss/parser.rb: regexp buffer overflow |
I came across this after I upgraded to rails 3.1, on ruby 1.8.7. Details on this gist: https://gist.github.com/306f9ab406ab98649073 |
By the way, the same happens when trying to compile jQuery Mobile's CSS (using Ruby 1.8.7). |
Let me take that back. jQuery Mobile's CSS goes through just fine with Sprockets on ruby 1.8.7. I traced the source of the exception to two problems I had in my SCSS:
I hope this helps someone else figure out their version of this problem. |
when I convert large css file on ubuntu with Sass 3.0.9 and ruby1.8 (1.8.7.299-2) I get same error, but on win7 with Sass 3.1.7 and ruby 1.9.2p290 everything is ok Probably it's not because of ubuntu, just because on win I have newer ruby 1.9 and Sass 3.1.7 |
Ok, this is getting weird. I've tracked my instance of the problem further, since it kept happening again. Our designer created the following style:
This style has been problematic every once in a while. It's reused with Here's a few examples with dummy selectors (I've actually tried them as is)
I've no idea if it's something that can be fixed to work on Ruby 1.8.7. I hope this helps SASS contributors track down this issue! |
Experiencing the same problem with '@extend' - assets:precompile fails with 'regexp buffer overflow' in unpredictable place. |
Just experienced the same problem. Problem: Notice the missing " from before Helvetica Neue". If a quote is missing, it's like have a ridiculously long string that the regexp parser chokes on. |
We're hitting this on Rails 3.1.1 / Ruby 1.8.7 when running "rake assets:precompile" |
For us, the problem is that Sass::SCSS::RX::STATIC_SELECTOR fails on a long selector (with Rails 3.1.1 / Ruby 1.8.7). I can replicate the problem with this scss file: .aaa {
background-color: white;
}
.aaa .aaa .aaa {
background-color: black;
}
.bbb {
@extend .aaa;
}
.xxx {
@extend .bbb;
}
.yyy {
@extend .bbb;
}
.zzz {
@extend .bbb;
} Running .aaa .aaa .aaa, .bbb .aaa .aaa, .xxx .aaa .aaa, .yyy .aaa .aaa, .zzz .aaa .aaa, .aaa .bbb .aaa, .bbb .bbb .aaa, .xxx .bbb .aaa, .yyy .bbb .aaa, .zzz .bbb .aaa, .aaa .xxx .aaa, .bbb .xxx .aaa, .xxx .xxx .aaa, .yyy .xxx .aaa, .zzz .xxx .aaa, .aaa .yyy .aaa, .bbb .yyy .aaa, .xxx .yyy .aaa, .yyy .yyy .aaa, .zzz .yyy .aaa, .aaa .zzz .aaa, .bbb .zzz .aaa, .xxx .zzz .aaa, .yyy .zzz .aaa, .zzz .zzz .aaa, .aaa .aaa .bbb, .bbb .aaa .bbb, .xxx .aaa .bbb, .yyy .aaa .bbb, .zzz .aaa .bbb, .aaa .bbb .bbb, .bbb .bbb .bbb, .xxx .bbb .bbb, .yyy .bbb .bbb, .zzz .bbb .bbb, .aaa .xxx .bbb, .bbb .xxx .bbb, .xxx .xxx .bbb, .yyy .xxx .bbb, .zzz .xxx .bbb, .aaa .yyy .bbb, .bbb .yyy .bbb, .xxx .yyy .bbb, .yyy .yyy .bbb, .zzz .yyy .bbb, .aaa .zzz .bbb, .bbb .zzz .bbb, .xxx .zzz .bbb, .yyy .zzz .bbb, .zzz .zzz .bbb, .aaa .aaa .xxx, .bbb .aaa .xxx, .xxx .aaa .xxx, .yyy .aaa .xxx, .zzz .aaa .xxx, .aaa .bbb .xxx, .bbb .bbb .xxx, .xxx .bbb .xxx, .yyy .bbb .xxx, .zzz .bbb .xxx, .aaa .xxx .xxx, .bbb .xxx .xxx, .xxx .xxx .xxx, .yyy .xxx .xxx, .zzz .xxx .xxx, .aaa .yyy .xxx, .bbb .yyy .xxx, .xxx .yyy .xxx, .yyy .yyy .xxx, .zzz .yyy .xxx, .aaa .zzz .xxx, .bbb .zzz .xxx, .xxx .zzz .xxx, .yyy .zzz .xxx, .zzz .zzz .xxx, .aaa .aaa .yyy, .bbb .aaa .yyy, .xxx .aaa .yyy, .yyy .aaa .yyy, .zzz .aaa .yyy, .aaa .bbb .yyy, .bbb .bbb .yyy, .xxx .bbb .yyy, .yyy .bbb .yyy, .zzz .bbb .yyy, .aaa .xxx .yyy, .bbb .xxx .yyy, .xxx .xxx .yyy, .yyy .xxx .yyy, .zzz .xxx .yyy, .aaa .yyy .yyy, .bbb .yyy .yyy, .xxx .yyy .yyy, .yyy .yyy .yyy, .zzz .yyy .yyy, .aaa .zzz .yyy, .bbb .zzz .yyy, .xxx .zzz .yyy, .yyy .zzz .yyy, .zzz .zzz .yyy, .aaa .aaa .zzz, .bbb .aaa .zzz, .xxx .aaa .zzz, .yyy .aaa .zzz, .zzz .aaa .zzz, .aaa .bbb .zzz, .bbb .bbb .zzz, .xxx .bbb .zzz, .yyy .bbb .zzz, .zzz .bbb .zzz, .aaa .xxx .zzz, .bbb .xxx .zzz, .xxx .xxx .zzz, .yyy .xxx .zzz, .zzz .xxx .zzz, .aaa .yyy .zzz, .bbb .yyy .zzz, .xxx .yyy .zzz, .yyy .yyy .zzz, .zzz .yyy .zzz, .aaa .zzz .zzz, .bbb .zzz .zzz, .xxx .zzz .zzz, .yyy .zzz .zzz, .zzz .zzz .zzz {
background-color: black;
} Clearly, the
This selector is long enough to cause the exception. This explains why some people are hitting this problem at unpredictable places. Adding a new selector that extends an existing selector may be enough, if the parent is also extended from elsewhere. This is basically how we hit the bug (we essentially added The exception itself occurs because REGEX = /.*(?=[x])/
(0..10_000_000).each do |i|
begin
REGEX.match("a" * i + "x")
rescue RegexpError => e
puts i ; break
end
end Removing the The fix for Ruby 1.8.7, then (apart from not parsing with regexes), is to remove the Here's one I prepared earlier: #219 |
This is resolved by 637ed00. |
This bug was reported here: sass#104
Note that Ruby 1.8.7 should be used when running this test, as 1.9 will pass regardless of whether the fix has been applied or not.
I get this error in version 3.4.13.
|
@binarious that is not a useful error report. Without giving us some Sass that triggers this error, there's nothing we can do to fix it. |
A coworker is currently having this same issue. Stack trace and sample command: hqtslpt2225:New Default Canvas v1.3.0.3090 mraab$ sass --scss --trace scss/app.scss
/Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/scss/parser.rb:1175:in `scan': regexp buffer overflow (StringScanner::Error)
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/scss/parser.rb:1175:in `tok'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/scss/parser.rb:822:in `almost_any_value_token'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/scss/parser.rb:800:in `almost_any_value'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/scss/parser.rb:634:in `ruleset'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/scss/parser.rb:660:in `block_child'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/scss/parser.rb:653:in `block_contents'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/scss/parser.rb:117:in `stylesheet'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/scss/parser.rb:42:in `parse'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/engine.rb:393:in `_to_tree'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/engine.rb:299:in `to_tree'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/perform.rb:323:in `visit_import'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/stack.rb:88:in `with_import'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/stack.rb:115:in `with_frame'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/stack.rb:88:in `with_import'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/perform.rb:322:in `visit_import'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/base.rb:36:in `send'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/base.rb:36:in `visit'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/perform.rb:158:in `visit'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/stack.rb:79:in `with_base'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/stack.rb:115:in `with_frame'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/stack.rb:79:in `with_base'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/perform.rb:158:in `visit'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/base.rb:52:in `visit_children'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/base.rb:52:in `map'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/base.rb:52:in `visit_children'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/perform.rb:167:in `visit_children'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/perform.rb:179:in `with_environment'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/perform.rb:166:in `visit_children'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/base.rb:36:in `visit'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/perform.rb:186:in `visit_root'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/base.rb:36:in `send'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/base.rb:36:in `visit'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/perform.rb:157:in `visit'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/perform.rb:8:in `send'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/visitors/perform.rb:8:in `visit'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/root_node.rb:36:in `css_tree'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/tree/root_node.rb:20:in `render'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/engine.rb:268:in `render'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/exec/sass_scss.rb:415:in `run'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/exec/sass_scss.rb:63:in `process_result'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/exec/base.rb:52:in `parse'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/../lib/sass/exec/base.rb:19:in `parse!'
from /Library/Ruby/Gems/1.8/gems/sass-3.4.13/bin/sass:13
from /usr/bin/sass:19:in `load'
from /usr/bin/sass:19 |
@Mad-Chemist same issue: without actual Sass code, there's no way for us to know how to fix the issue. |
We resolved this issue by upgrading her ruby and sass versions. Which ended up also including an xcode, command line tools, and rvm update as well. It was a few hours of dependency installations... |
Originally filed against haml by @sylvinus and commented on by @LayerDownInc & @matthewee.
css/apple.css from Sencha Touch 1.1 (wasn't happening with 1.0)
latest sass
The text was updated successfully, but these errors were encountered: