Skip to content
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

refactor(rust): Fencepost error in debug assertion in splitfields #18423

Merged
merged 2 commits into from
Aug 28, 2024

Conversation

wence-
Copy link
Collaborator

@wence- wence- commented Aug 28, 2024

For some slice v of length n, it is UB to call get_unchecked with a range starting at n+1. Previously, we asserted that pos <= n, which is the requirement for v.get_unchecked(..pos), but not v.get_unchecked(pos+1..) which has the tighter requirement pos < n.

While here, after #18413, tighten the extent of an unsafe block.

For some slice `v` of length `n`, it is UB to call `get_unchecked`
with a range starting at `n+1`. Previously, we asserted that `pos <=
n`, which is the requirement for `v.get_unchecked(..pos)`, but not
`v.get_unchecked(pos+1..)` which has the tighter requirement `pos <
n`.
@github-actions github-actions bot added internal An internal refactor or improvement rust Related to Rust Polars labels Aug 28, 2024
@wence-
Copy link
Collaborator Author

wence- commented Aug 28, 2024

Noticed while reviewing #18413.

@wence- wence- changed the title refactor(rust): Fix fencepost debug assertion in splitfields refactor(rust): Fix fencepost error in debug assertion in splitfields Aug 28, 2024
@wence- wence- changed the title refactor(rust): Fix fencepost error in debug assertion in splitfields fix(rust): fencepost error in debug assertion in splitfields Aug 28, 2024
@wence- wence- changed the title fix(rust): fencepost error in debug assertion in splitfields fix(rust): Fencepost error in debug assertion in splitfields Aug 28, 2024
@github-actions github-actions bot added fix Bug fix and removed title needs formatting labels Aug 28, 2024
Copy link

codecov bot commented Aug 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.91%. Comparing base (fb38919) to head (17ac49a).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #18423   +/-   ##
=======================================
  Coverage   79.91%   79.91%           
=======================================
  Files        1495     1495           
  Lines      200261   200279   +18     
  Branches     2867     2867           
=======================================
+ Hits       160033   160051   +18     
  Misses      39682    39682           
  Partials      546      546           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ritchie46 ritchie46 changed the title fix(rust): Fencepost error in debug assertion in splitfields refactor(rust): Fencepost error in debug assertion in splitfields Aug 28, 2024
@ritchie46
Copy link
Member

I rebranded it as a refactor. As only a debug assert was wrong, not the actual implementation.

@ritchie46 ritchie46 merged commit 37a492e into pola-rs:main Aug 28, 2024
25 of 26 checks passed
@wence- wence- deleted the wence/fix/splitfields-assert branch August 28, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix internal An internal refactor or improvement rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants