Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
FFI 0.13.0 no longer ignores invalid parameters #788
The ffi 0.13.0 release on Windows switched to using the universal C runtime instead of msvcrt in https://github.com/ffi/ffi/pull/779/files#diff-db0e38803c251431bdf21ae8936ac3f6L132-R132. Previously, msvcrt ignored invalid parameters, but ucrtbase will abort by default
This can be demonstrated using:
require 'ffi' module MSVCRT extend FFI::Library ffi_lib 'msvcrt' attach_function(:get_osfhandle, :_get_osfhandle, [:int], :intptr_t) end module UCRTBASE extend FFI::Library ffi_lib 'ucrtbase' attach_function(:get_osfhandle, :_get_osfhandle, [:int], :intptr_t) end puts "msvcrt" puts MSVCRT.get_osfhandle(42) puts "ucrtbase" puts UCRTBASE.get_osfhandle(42) # we never get here puts "Done"
Note that "Done" is never printed:
This isn't a problem with FFI, but the ruby process aborts with
@joshcooper Thank you for your great analysis!
Obviously the change of
ffi-1.13.0 switched FFI::Library::LIBC from msvcrt.dll to ucrtbase.dll as part of ffi#779 in commit c674683 . As described in ffi#788 ucrtbase.dll has behavioural changes which shouldn't be released as part of a minor version change of ffi. While the change makes sense for mswin, we revert it for mingw. Fixes ffi#788