Replies: 3 comments
|
@anrossi Can you please clarify? |
|
Suppose the MsQuic user code looks like this, uint8_t MyCompactData[5];
uint32_t GetLength = 2;
MsQuic->GetParam(nullptr, QUIC_PARAM_GLOBAL_RETRY_MEMORY_PERCENT, &GetLength, &MyCompactData[1]);The pointer they're passing in to receive the parameter is not aligned. MsQuic needs to document that this is not a valid usage of the API, or it needs to handle this kind of scenario. |
|
IMO the API caller must provide a buffer to satisfy both the size and alignment requirements of the documented I/O type. It seems fair game for MsQuic to validate the buffer pointer is aligned as required and fail the API if it is not properly aligned, because buffer sizes are validated the same way. |
Uh oh!
There was an error while loading. Please reload this page.
It appears MsQuic doesn't have a consistent stance on whether pointers passed into API calls are required to be aligned.
Some API calls will cast and dereference the pointer, which assumes it is aligned, while others use
memcpyto handle when the pointer is unaligned.We should either require callers to use aligned pointers (and document it) or expect callers to provide unaligned pointers and handle it appropriately.
Originally posted by @anrossi in #5376 (comment)
All reactions