mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-10 08:40:57 +00:00
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>
This commit is contained in:
parent
6031e5d1af
commit
8b5b756c4d
@ -152,8 +152,8 @@ int ff_vorbis_comment(AVFormatContext *as, AVDictionary **m,
|
|||||||
* recommended way of embedding cover art within VorbisComments."
|
* recommended way of embedding cover art within VorbisComments."
|
||||||
*/
|
*/
|
||||||
if (!strcmp(tt, "METADATA_BLOCK_PICTURE") && parse_picture) {
|
if (!strcmp(tt, "METADATA_BLOCK_PICTURE") && parse_picture) {
|
||||||
int ret;
|
int ret, len = AV_BASE64_DECODE_SIZE(vl);
|
||||||
char *pict = av_malloc(vl);
|
char *pict = av_malloc(len);
|
||||||
|
|
||||||
if (!pict) {
|
if (!pict) {
|
||||||
av_log(as, AV_LOG_WARNING, "out-of-memory error. Skipping cover art block.\n");
|
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);
|
av_freep(&ct);
|
||||||
continue;
|
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);
|
ret = ff_flac_parse_picture(as, pict, ret);
|
||||||
av_freep(&tt);
|
av_freep(&tt);
|
||||||
av_freep(&ct);
|
av_freep(&ct);
|
||||||
|
Loading…
Reference in New Issue
Block a user