Dominique Pellé wrote: > Christopher Chow wrote: > >> When I start vim with vim -u NONE -N with the following code in a ruby file: >> >> class Billing::EstimatedImportStrategy < Billing::GapImportStrategy >> def applicable? >> has_previous_and_next_data? && has_historic_amount_data? >> end >> >> def has_historic_amount_data? >> estimated_import.historic_previous_amount.present? && >> estimated_import.historic_gap_period.any? && >> estimated_import.historic_next_amount.present? >> end >> >> def has_previous_and_next_data? >> estimated_import.previous_amount.present? && >> estimated_import.next_amount.present? >> end >> >> def estimated_import >> @estimated_import ||= >> Billing::EstimatedImport.new(:started_on => gap.started_on, :ended_on >> => gap.ended_on, :asset_id => meter.asset.id, >> :resource_type_id => >> gap.resource_type.id, :division_id => meter.asset.division_id, >> :organisation_id => >> meter.asset.organisation_id, :processed => false, :amount => nil, :meter_id >> => meter.id) >> end >> >> def apply >> estimated_import.save! >> end >> end >> >> When I run :syntax on, I get a segfault in vim. Here's the output from >> bugreport.vim: https://gist.github.com/Soliah/6217770 > > > It did not crash for me on Linux, however, valgrind finds a > bug with vim-7.4 (huge, Linux x86_64): > > $ valgrind --log-file=valgrind.log vim -u NONE -N -c 'syn on' foo.rb > > ==5283== Invalid write of size 8 > ==5283== at 0x56062B: addstate (regexp_nfa.c:4172) > ==5283== by 0x560675: addstate_here (regexp_nfa.c:4290) > ==5283== by 0x56A81C: nfa_regmatch (regexp_nfa.c:5369) > ==5283== by 0x56C73B: nfa_regtry (regexp_nfa.c:6349) > ==5283== by 0x56CC07: nfa_regexec_both (regexp_nfa.c:6533) > ==5283== by 0x5C3E78: syn_regexec (syntax.c:3272) > ==5283== by 0x5CA6D6: syn_current_attr (syntax.c:2092) > ==5283== by 0x5CF1B7: get_syntax_attr (syntax.c:1851) > ==5283== by 0x581A8E: win_line (screen.c:4274) > ==5283== by 0x58858F: win_update (screen.c:2010) > ==5283== by 0x58BE31: update_screen.part.21 (screen.c:681) > ==5283== by 0x624A26: main_loop (main.c:1232) > ==5283== Address 0xe383a88 is 87,752 bytes inside a block of size 99,280 > free'd > ==5283== at 0x4C2B4F0: realloc (in > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) > ==5283== by 0x5602D2: addstate (regexp_nfa.c:4022) > ==5283== by 0x560196: addstate (regexp_nfa.c:4060) > ==5283== by 0x560157: addstate (regexp_nfa.c:4167) > ==5283== by 0x560675: addstate_here (regexp_nfa.c:4290) > ==5283== by 0x56A81C: nfa_regmatch (regexp_nfa.c:5369) > ==5283== by 0x56C73B: nfa_regtry (regexp_nfa.c:6349) > ==5283== by 0x56CC07: nfa_regexec_both (regexp_nfa.c:6533) > ==5283== by 0x5C3E78: syn_regexec (syntax.c:3272) > ==5283== by 0x5CA6D6: syn_current_attr (syntax.c:2092) > ==5283== by 0x5CF1B7: get_syntax_attr (syntax.c:1851) > ==5283== by 0x581A8E: win_line (screen.c:4274) > ==5283== > ==5283== Invalid write of size 4 > ==5283== at 0x56062F: addstate (regexp_nfa.c:4172) > ==5283== by 0x560675: addstate_here (regexp_nfa.c:4290) > ==5283== by 0x56A81C: nfa_regmatch (regexp_nfa.c:5369) > ==5283== by 0x56C73B: nfa_regtry (regexp_nfa.c:6349) > ==5283== by 0x56CC07: nfa_regexec_both (regexp_nfa.c:6533) > ==5283== by 0x5C3E78: syn_regexec (syntax.c:3272) > ==5283== by 0x5CA6D6: syn_current_attr (syntax.c:2092) > ==5283== by 0x5CF1B7: get_syntax_attr (syntax.c:1851) > ==5283== by 0x581A8E: win_line (screen.c:4274) > ==5283== by 0x58858F: win_update (screen.c:2010) > ==5283== by 0x58BE31: update_screen.part.21 (screen.c:681) > ==5283== by 0x624A26: main_loop (main.c:1232) > ==5283== Address 0xe383a90 is 87,760 bytes inside a block of size 99,280 > free'd > ==5283== at 0x4C2B4F0: realloc (in > /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) > ==5283== by 0x5602D2: addstate (regexp_nfa.c:4022) > ==5283== by 0x560196: addstate (regexp_nfa.c:4060) > ==5283== by 0x560157: addstate (regexp_nfa.c:4167) > ==5283== by 0x560675: addstate_here (regexp_nfa.c:4290) > ==5283== by 0x56A81C: nfa_regmatch (regexp_nfa.c:5369) > ==5283== by 0x56C73B: nfa_regtry (regexp_nfa.c:6349) > ==5283== by 0x56CC07: nfa_regexec_both (regexp_nfa.c:6533) > ==5283== by 0x5C3E78: syn_regexec (syntax.c:3272) > ==5283== by 0x5CA6D6: syn_current_attr (syntax.c:2092) > ==5283== by 0x5CF1B7: get_syntax_attr (syntax.c:1851) > ==5283== by 0x581A8E: win_line (screen.c:4274) > > > I can reproduce it with a much simpler input file > containing just 6 spaces and a x: > > $ cat foo.rb > x > $ vim valgrind --log-file=valgrind.log vim -u NONE -N -c 'syn on' foo.rb > > Regards > Dominique
I could narrow it down further. I can reproduce it with: # Create a file (6 space and a x, bug does not happen with less than 6 spaces): $ echo " x" > foo $ valgrind --log-file=valgrind.log vim -u NONE -N -c 'syn on' foo Then in Vim-7.4 (huge, Linux x86_64) search for: /\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>\%(\s*(\)\@! and observe errors in valgrind.log. Above regexp is actually used in syntax/ruby.rb: syn match rubyPredefinedConstant "\%(\%(\.\@<!\.\)\@<!\|::\)\_s*\zs\%(MatchingData\|ARGF\|ARGV\|ENV\)\>\%(\s*(\)\@!" Regards Dominique -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
