mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Optimize output buffer size check in base64 decode.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
This commit is contained in:
parent
686ba5f4ea
commit
6af4c9814a
@ -47,6 +47,7 @@ int av_base64_decode(uint8_t *out, const char *in, int out_size)
|
||||
{
|
||||
int i, v;
|
||||
uint8_t *dst = out;
|
||||
uint8_t *end = out + out_size;
|
||||
|
||||
v = 0;
|
||||
for (i = 0; ; i++) {
|
||||
@ -55,7 +56,7 @@ int av_base64_decode(uint8_t *out, const char *in, int out_size)
|
||||
return in[i] && in[i] != '=' ? -1 : dst - out;
|
||||
v = (v << 6) + map2[index];
|
||||
if (i & 3) {
|
||||
if (dst - out < out_size) {
|
||||
if (dst < end) {
|
||||
*dst++ = v >> (6 - 2 * (i & 3));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user