forked from mpaland/printf
-
Notifications
You must be signed in to change notification settings - Fork 58
Closed
Labels
bugSomething isn't workingSomething isn't workingresolved-on-developA changeset fixing this issue has been commiutted to the development branchA changeset fixing this issue has been commiutted to the development branch
Description
printf()-family functions have the questionable design choice of returning int
as the number of characters printed, despite buffer lengths possibly being larger than INT_MAX
.
In our implementation, this is compounded by us using an int-sized printf_size_t
type for offsets and lengths within the buffer, corresponding to the final return type - while taking in a size_t
for functions such as snprintf()
. At the moment, we simply cast from the latter into the former type at various locations, never checking for overflow. This could theoretically result in us getting lengths of 0, or other short lengths, which will mess up our behavior.
We need to cast as early as possible, and discard the size_t
inputs.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingresolved-on-developA changeset fixing this issue has been commiutted to the development branchA changeset fixing this issue has been commiutted to the development branch