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

DataLayout Backing Array Dimension Checks #664

Closed
jb-mackay opened this issue Apr 14, 2022 · 1 comment
Closed

DataLayout Backing Array Dimension Checks #664

jb-mackay opened this issue Apr 14, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@jb-mackay
Copy link
Contributor

Some DataLayout objects have constructors that allow for backing arrays with dimensions that don't match what one would expect given the stored types.

e.g.

FT = Float64
S = Complex{FT}
vf1 = VF{S}(Matrix{FT}, 3)
vf2 = VF{S}(ones(3, 7))

Here, vf1 generates a VF struct with a backing array of the expected size (3 x 2 as v = 3 and complex components need two elements). However, vf2 also works and creates a backing array with size 3 x 7; in this case, more than half of this stored data is inaccessible and unused.

We can add a typesize check in the bugged constructor to prevent this. The other DataLayout constructors should be reviewed for similar issues.

@jb-mackay jb-mackay self-assigned this Apr 14, 2022
@jb-mackay jb-mackay added the bug Something isn't working label Apr 14, 2022
@charleskawczynski
Copy link
Member

Fixed by #665.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants