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

UB in shuffle_avx2 and unshuffle_avx2 #636

Closed
EmilDohne opened this issue Oct 16, 2024 · 3 comments
Closed

UB in shuffle_avx2 and unshuffle_avx2 #636

EmilDohne opened this issue Oct 16, 2024 · 3 comments

Comments

@EmilDohne
Copy link
Contributor

EmilDohne commented Oct 16, 2024

Describe the bug

These two typedefs suggest that both _src and _dest should be const uint8_t*.

typedef void(* shuffle_func)(const int32_t, const int32_t, const uint8_t*, const uint8_t*);
typedef void(* unshuffle_func)(const int32_t, const int32_t, const uint8_t*, const uint8_t*);

However, the avx2 implementation does not take a const uint8_t* but instead a uint8_t*. On further inspection this seems to hold true for other implementations. To my knowledge, all calls to shuffle actually call with a non-const pointer so I think it's likely fine to make these values non-const

Logs
Below you can find a fsanitize=undefined run that points this out:

https://github.com/EmilDohne/PhotoshopAPI/actions/runs/11365462630/job/31613700651

EmilDohne added a commit to EmilDohne/PhotoshopAPI that referenced this issue Oct 16, 2024
@FrancescAlted
Copy link
Member

This sounds reasonable to me. Would you mind providing a PR?

@EmilDohne
Copy link
Contributor Author

I can definitely have a look at providing one!

@EmilDohne
Copy link
Contributor Author

Fixed by #638

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

No branches or pull requests

2 participants