libavutil/base64: Try not to write over the array end

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 2d216566f2)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
release/7.0
Michael Niedermayer 8 months ago
parent 559dd6f68a
commit b9985f105e
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
  1. 6
      libavutil/base64.c

@ -127,10 +127,12 @@ validity_check:
}
out3:
*dst++ = v >> 10;
if (end - dst)
*dst++ = v >> 10;
v <<= 2;
out2:
*dst++ = v >> 4;
if (end - dst)
*dst++ = v >> 4;
out1:
out0:
return bits & 1 ? AVERROR_INVALIDDATA : out ? dst - out : 0;

Loading…
Cancel
Save