-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
cbprintf: Package size calculation is using best case alignment #33208
Comments
Document that the buffer needs to be aligned and sized based on the requirements of the arguments, and that if not some format operations will fail due to space lost to enforce necessary alignment. Or stop trying to do alignment in the packed version. I can see alternating |
Didn't notice earlier but it states in the api: |
Describe the bug
cbprintf_package(NULL, 0, ..)
supposes to return required space needed to pack string with arguments. It is usingNULL
address for calculating alignment which is 8 and 16 bytes aligned. However, size depends on initial alignment of the buffer. As a result following code may fail:Expected behavior
There are few options:
len
field to indicate alignment of the buffer that will be used.Impact
Unexpected error due to too small buffer.
The text was updated successfully, but these errors were encountered: