Integer overflow in base64
Critical severity
GitHub Reviewed
Published
Aug 25, 2021
to the GitHub Advisory Database
•
Updated Jan 11, 2023
Description
Reviewed
Aug 19, 2021
Published to the GitHub Advisory Database
Aug 25, 2021
Last updated
Jan 11, 2023
Affected versions of this crate suffered from an integer overflow bug when
calculating the size of a buffer to use when encoding base64 using the
encode_config_buf
andencode_config
functions. If the input stringwas large, this would cause a buffer to be allocated that was too small.
Since this function writes to the buffer using unsafe code, it would
allow an attacker to write beyond the buffer, causing memory corruption
and possibly the execution of arbitrary code.
This flaw was corrected by using checked arithmetic to calculate
the size of the buffer.
References