summaryrefslogtreecommitdiff
path: root/libavformat/oggparsevorbis.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2016-06-16 19:10:42 -0300
committerJames Almer <jamrial@gmail.com>2016-06-20 23:04:35 -0300
commit8b5b756c4d78c80051d23f2e95d21de01d74cd1f (patch)
tree8d62f0836aeda5e50c7657a3c4e6fdb91d446d0e /libavformat/oggparsevorbis.c
parent6031e5d1af934727e7a014b521aa8303f669a2f3 (diff)
avformat/oggparsevorbis: use the base64 decode size macro
Allocate the memory needed for the decoded data rather than the encoded data. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/oggparsevorbis.c')
-rw-r--r--libavformat/oggparsevorbis.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c
index a8cd6c9f97..c16871873e 100644
--- a/libavformat/oggparsevorbis.c
+++ b/libavformat/oggparsevorbis.c
@@ -152,8 +152,8 @@ int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m,
* recommended way of embedding cover art within VorbisComments."
*/
if (!strcmp(tt, "METADATA_BLOCK_PICTURE") && parse_picture) {
- int ret;
- char *pict = av_malloc(vl);
+ int ret, len = AV_BASE64_DECODE_SIZE(vl);
+ char *pict = av_malloc(len);
if (!pict) {
av_log(as, AV_LOG_WARNING, "out-of-memory error. Skipping cover art block.\n");
@@ -161,7 +161,7 @@ int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m,
av_freep(&ct);
continue;
}
- if ((ret = av_base64_decode(pict, ct, vl)) > 0)
+ if ((ret = av_base64_decode(pict, ct, len)) > 0)
ret = ff_flac_parse_picture(as, pict, ret);
av_freep(&tt);
av_freep(&ct);