aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/base64.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2024-05-11 03:13:17 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2024-05-13 03:26:57 +0200
commit2d216566f258badd07bc58de1e089b6e4175dc46 (patch)
treebe5cfda30569e6a36b6f038bfc692d83dfaa06e2 /libavutil/base64.c
parent0664cbd732fd9d95037d9110b64fb2a32360de2c (diff)
downloadffmpeg-2d216566f258badd07bc58de1e089b6e4175dc46.tar.gz
libavutil/base64: Try not to write over the array end
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavutil/base64.c')
-rw-r--r--libavutil/base64.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavutil/base64.c b/libavutil/base64.c
index 3e66f4fcbe..69e11e6f5e 100644
--- a/libavutil/base64.c
+++ b/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;