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

fix: Limit memory allocation by MAX_CRYPTO_DATA_SIZE #2766

Conversation

nickolay168
Copy link

@nickolay168 nickolay168 commented Sep 15, 2024

This PR is intended to fix the issue, when shiny object is shown to the camera during the call. In this scenario camera creates big frames, for which toxcore tries to allocate memory and if the frame is big enough, it may fail, resulting in overflow error.

In this fix we limit the allocation size to MAX_CRYPTO_DATA_SIZE and, limit the frame size to UINT16_MAX (we use length_safe instead of length variable).

I have tested the fix on qTox client.

See issue


This change is Reviewable

@nickolay168 nickolay168 force-pushed the nick168/avoid_extra_memory_allocation branch from b65b030 to a068236 Compare September 15, 2024 03:55
@nickolay168 nickolay168 changed the title Limit memory allocation by MAX_CRYPTO_DATA_SIZE fix: Limit memory allocation by MAX_CRYPTO_DATA_SIZE Sep 15, 2024
@Green-Sky
Copy link
Member

@nickolay168 We appreciate your effort, but I found a better fix in #2768 . I hope we see more code changes from you :)

@Green-Sky Green-Sky closed this Sep 17, 2024
@nickolay168
Copy link
Author

Sure! I will help with what I can.

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.

2 participants