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

negative value cast to unsigned when calculating bytes #35

Open
thirtytwobits opened this issue Feb 7, 2025 · 0 comments
Open

negative value cast to unsigned when calculating bytes #35

thirtytwobits opened this issue Feb 7, 2025 · 0 comments

Comments

@thirtytwobits
Copy link

https://github.com/mattconte/tlsf/blob/master/tlsf.c#L1100 bytes - tlsf_size() where bytes < tlsf_size() yields a junk result in the tlsf_add_pool function.

Given a value of 40 bytes this leads to segfaults. Given a value of 4096 bytes this leads to https://github.com/mattconte/tlsf/blob/master/tlsf.c#L997 reporting that the buffer is too large. (this reproduced on aarch64).

I'd add a check that bytes is > tlsf_size() and document that the buffer provided must be greater than this value.

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

1 participant