Project

General

Profile

Actions

Bug #13327

closed

Segfault on OSX when using ffi-aspell

Added by petems (Peter Souter) over 7 years ago. Updated over 7 years ago.

Status:
Third Party's Issue
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin15]
[ruby-core:80221]

Description

Issue: Segfault on OSX when using ffi-aspell set method

Reproducable test case:

require 'ffi/aspell';speller = ::FFI::Aspell::Speller.new('en_US');speller.set('mode', 'html');puts speller.correct?('foo');

Expected behaviour:

$ ruby -e "require 'ffi/aspell';speller = ::FFI::Aspell::Speller.new('en_US');speller.set('mode', 'html');puts speller.correct?('foo');"
true

Actual behaviour:

$ ruby -e "require 'ffi/aspell';speller = ::FFI::Aspell::Speller.new('en_US');speller.set('mode', 'html');puts speller.correct?('foo');
/Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-aspell-1.1.0/lib/ffi/aspell/speller.rb:219: [BUG] Segmentation fault at 0x0000000000d631
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin15]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:
     * ~/Library/Logs/CrashReporter
     * /Library/Logs/CrashReporter
     * ~/Library/Logs/DiagnosticReports
     * /Library/Logs/DiagnosticReports
   for more details.
Don't forget to include the above Crash Report log file in bug reports.

-- Control frame information -----------------------------------------------
c:0004 p:---- s:0017 e:000016 CFUNC  :speller_check
c:0003 p:0080 s:0011 e:000010 METHOD /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-aspell-1.1.0/lib/ffi/aspell/speller.rb:219
c:0002 p:0048 s:0006 E:001e08 EVAL   -e:1 [FINISH]
c:0001 p:0000 s:0002 E:000b90 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
-e:1:in `<main>'
/Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-aspell-1.1.0/lib/ffi/aspell/speller.rb:219:in `correct?'
/Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-aspell-1.1.0/lib/ffi/aspell/speller.rb:219:in `speller_check'

-- Machine register context ------------------------------------------------
 rax: 0x00007fa6e383ca98 rbx: 0x00007fa6e298cf10 rcx: 0x00007fa6e298cf30
 rdx: 0x0000000000000003 rdi: 0x000000000000d5c1 rsi: 0x00007fa6e18842d8
 rbp: 0x00007fff51eaea90 rsp: 0x00007fff51eaea90  r8: 0x00007fa600040001
  r9: 0x000000010dfe8000 r10: 0x00007fff51eaea30 r11: 0x000000010e392395
 r12: 0x0000000000000001 r13: 0x0000000000000003 r14: 0x00007fa6e298cf30
 r15: 0x0000000000000000 rip: 0x000000010e3711d0 rfl: 0x0000000000010206

-- C level backtrace information -------------------------------------------
0   ruby                                0x000000010def8da4 rb_vm_bugreport + 388
1   ruby                                0x000000010dd94b8a rb_bug_context + 490
2   ruby                                0x000000010de69384 sigsegv + 68
3   libsystem_platform.dylib            0x00007fff9a58a52a _sigtramp + 26
4   libaspell.dylib                     0x000000010e3711d0 _ZN7acommon7Convert7convertEPKciRNS_6StringE + 4
5   libaspell.dylib                     0x000000010e3923bf aspell_speller_check + 42
6   libffi.dylib                        0x00007fff9b6c5f14 ffi_call_unix64 + 76
7   libffi.dylib                        0x00007fff9b6c679b ffi_call + 923
8   ffi_c.bundle                        0x000000010e335d55 rbffi_CallFunction + 229
9   ffi_c.bundle                        0x000000010e339889 custom_trampoline + 25
10  ruby                                0x000000010deeefea vm_call_cfunc + 314
11  ruby                                0x000000010ded97bf vm_exec_core + 10175
12  ruby                                0x000000010dee982a vm_exec + 122
13  ruby                                0x000000010dd9d6a8 ruby_exec_internal + 152
14  ruby                                0x000000010dd9d5b6 ruby_run_node + 54
15  ruby                                0x000000010dd50b5f main + 79

-- Other runtime information -----------------------------------------------

* Loaded script: -e

* Loaded features:

    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/x86_64-darwin15/enc/encdb.bundle
    5 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/x86_64-darwin15/enc/trans/transdb.bundle
    6 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/unicode_normalize.rb
    7 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/x86_64-darwin15/rbconfig.rb
    8 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/compatibility.rb
    9 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/defaults.rb
   10 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/deprecate.rb
   11 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/errors.rb
   12 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/version.rb
   13 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/requirement.rb
   14 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/platform.rb
   15 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/basic_specification.rb
   16 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/stub_specification.rb
   17 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/util/list.rb
   18 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/x86_64-darwin15/stringio.bundle
   19 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/specification.rb
   20 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/exceptions.rb
   21 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/dependency.rb
   22 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb
   23 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/monitor.rb
   24 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb
   25 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems.rb
   26 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/rubygems/path_support.rb
   27 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/did_you_mean-1.0.0/lib/did_you_mean/version.rb
   28 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/did_you_mean-1.0.0/lib/did_you_mean/core_ext/name_error.rb
   29 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/did_you_mean-1.0.0/lib/did_you_mean/levenshtein.rb
   30 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/did_you_mean-1.0.0/lib/did_you_mean/jaro_winkler.rb
   31 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/did_you_mean-1.0.0/lib/did_you_mean/spell_checkable.rb
   32 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/2.3.0/delegate.rb
   33 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/did_you_mean-1.0.0/lib/did_you_mean/spell_checkers/name_error_checkers/class_name_checker.rb
   34 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/did_you_mean-1.0.0/lib/did_you_mean/spell_checkers/name_error_checkers/variable_name_checker.rb
   35 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/did_you_mean-1.0.0/lib/did_you_mean/spell_checkers/name_error_checkers.rb
   36 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/did_you_mean-1.0.0/lib/did_you_mean/spell_checkers/method_name_checker.rb
   37 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/did_you_mean-1.0.0/lib/did_you_mean/spell_checkers/null_checker.rb
   38 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/did_you_mean-1.0.0/lib/did_you_mean/formatter.rb
   39 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/did_you_mean-1.0.0/lib/did_you_mean.rb
   40 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-1.9.18/lib/ffi_c.bundle
   41 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-1.9.18/lib/ffi/platform.rb
   42 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-1.9.18/lib/ffi/types.rb
   43 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-1.9.18/lib/ffi/library.rb
   44 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-1.9.18/lib/ffi/errno.rb
   45 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-1.9.18/lib/ffi/pointer.rb
   46 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-1.9.18/lib/ffi/memorypointer.rb
   47 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-1.9.18/lib/ffi/struct_layout_builder.rb
   48 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-1.9.18/lib/ffi/struct.rb
   49 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-1.9.18/lib/ffi/union.rb
   50 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-1.9.18/lib/ffi/managedstruct.rb
   51 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-1.9.18/lib/ffi/callback.rb
   52 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-1.9.18/lib/ffi/io.rb
   53 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-1.9.18/lib/ffi/autopointer.rb
   54 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-1.9.18/lib/ffi/variadic.rb
   55 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-1.9.18/lib/ffi/enum.rb
   56 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-1.9.18/lib/ffi/ffi.rb
   57 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-1.9.18/lib/ffi.rb
   58 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-aspell-1.1.0/lib/ffi/aspell/aspell.rb
   59 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-aspell-1.1.0/lib/ffi/aspell/error.rb
   60 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-aspell-1.1.0/lib/ffi/aspell/speller.rb
   61 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-aspell-1.1.0/lib/ffi/aspell/version.rb
   62 /Users/petersouter/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ffi-aspell-1.1.0/lib/ffi/aspell.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Abort trap: 6

Setting the mode is the reason it segfaults. Without the mode it's fine:

$ ruby -e "require 'ffi/aspell';speller = ::FFI::Aspell::Speller.new('en_US');puts speller.correct?('foo');"
true

I've attached the crash log.

This appears to affect all rubies. Tried with rbenv:

  • system
  • 2.1.10
  • 2.2.5
  • 2.3.3
  • 2.4.0

This appears to only affect OSX., I tried on an Ubuntu 16.04 machine and it worked fine:

$ uname -a 
Linux ubuntu-test 4.4.0-64-generic #85-Ubuntu SMP Mon Feb 20 11:50:30 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
$ ruby --version
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
$ ruby -e "require 'ffi/aspell';speller = ::FFI::Aspell::Speller.new('en_US');speller.set('mode', 'html');puts speller.correct?('foo');"
true

Files

ruby_2017-03-18-194116_Peters-MacBook-Pro-4.crash (11.8 KB) ruby_2017-03-18-194116_Peters-MacBook-Pro-4.crash Crash Log petems (Peter Souter), 03/18/2017 06:41 PM
Actions #1

Updated by petems (Peter Souter) over 7 years ago

  • Description updated (diff)
Actions #2

Updated by petems (Peter Souter) over 7 years ago

  • Description updated (diff)

Updated by nobu (Nobuyoshi Nakada) over 7 years ago

  • Status changed from Open to Third Party's Issue

A bug in ffi-aspell or (less probably) aspell library.
FFI can very easily cause segfault.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0