Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Improved checks to safety invariants in FFI #1154

Merged
merged 1 commit into from Jul 12, 2022
Merged

Conversation

jorgecarleitao
Copy link
Owner

This PR replaces asserts by errors on reading from FFI, and makes the docs of internal functions more explicit about what is the invariant being up-held. It does not cover every invariant that the "C data interface" requires, but it bring us closer to it.

Note that this does not change anything about the unsafe of the FFI - the main change is that we no longer panic if the passed data is incorrect, we just error. We further error if pointers are not properly aligned (which are part of the C data interface invariant but we can check them at O(1) and provide a good error message).

@codecov
Copy link

codecov bot commented Jul 11, 2022

Codecov Report

Merging #1154 (e7c3cbd) into main (6de9edf) will decrease coverage by 0.06%.
The diff coverage is 62.10%.

@@            Coverage Diff             @@
##             main    #1154      +/-   ##
==========================================
- Coverage   83.67%   83.61%   -0.07%     
==========================================
  Files         365      365              
  Lines       35865    35914      +49     
==========================================
+ Hits        30011    30029      +18     
- Misses       5854     5885      +31     
Impacted Files Coverage Δ
src/ffi/array.rs 81.90% <62.10%> (-7.63%) ⬇️
src/io/ipc/read/array/boolean.rs 90.74% <0.00%> (-7.41%) ⬇️
src/io/ipc/read/common.rs 95.31% <0.00%> (+0.39%) ⬆️
src/io/ipc/read/reader.rs 96.65% <0.00%> (+0.66%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6de9edf...e7c3cbd. Read the comment docs.

@jorgecarleitao jorgecarleitao added the enhancement An improvement to an existing feature label Jul 12, 2022
@jorgecarleitao jorgecarleitao merged commit 87b37ba into main Jul 12, 2022
@jorgecarleitao jorgecarleitao deleted the improve_checks branch July 12, 2022 15:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement An improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant