diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-08-23 11:24:20 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-08-28 15:25:18 +0200 |
commit | b10a8a30dbf605fb0761c9ee64cfbe8cb87ba710 (patch) | |
tree | b7cac5504141838ff42e63891e7aabce6ea5a168 /libavformat/flacdec.c | |
parent | f1d89d6dd0aa825d48e9be13837d77e8c1964fe8 (diff) | |
download | ffmpeg-b10a8a30dbf605fb0761c9ee64cfbe8cb87ba710.tar.gz |
avformat/oggparsevorbis: Avoid tmp bufs when parsing VorbisComment
A single VorbisComment consists of a length field and a
non-NUL-terminated string of the form "key=value". Up until now,
when parsing such a VorbisComment, zero-terminated duplicates of
key and value would be created. This is wasteful if these duplicates
are freed shortly afterwards, as happens in particular in case of
attached pictures: In this case value is base64 encoded and only
needed to decode the actual data.
Therefore this commit changes this: The buffer is temporarily modified
so that both key and value are zero-terminated. Then the data is used
in-place and restored to its original state afterwards.
This requires that the buffer has at least one byte of padding. All
buffers currently have AV_INPUT_BUFFER_PADDING_SIZE bytes padding,
so this is ok.
Finally, this also fixes weird behaviour from ogm_chapter():
It sometimes freed given to it, leaving the caller with dangling
pointers.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/flacdec.c')
0 files changed, 0 insertions, 0 deletions