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

Add missing checks for length match in reshaping methods #170

Merged
merged 1 commit into from
May 12, 2024

Conversation

robertknight
Copy link
Owner

Failing to check the requirements for length match or contiguity when reshaping
is a sure fire way to cause OOB reads.

  • Change TensorBase to call MutLayout::reshaped to ensure the new
    shape is checked for compatibility with the existing layout length
    and contiguous-ness.

  • Change reshaping methods in layout.rs to return results, as these
    are more convenient to work with in tests.

  • Remove unused mutating Layout::reshape methods

 - Change `TensorBase` to call `MutLayout::reshaped` to ensure the new
   shape is checked for compatibility with the existing layout length
   and contiguous-ness.

 - Change reshaping methods in `layout.rs` to return results, as these
   are more convenient to work with in tests.

 - Remove unused mutating `Layout::reshape` methods
@robertknight robertknight marked this pull request as ready for review May 12, 2024 10:35
@robertknight robertknight merged commit afa2cce into main May 12, 2024
2 checks passed
@robertknight robertknight deleted the add-shape-data-len-checks branch May 12, 2024 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant