mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-24 08:12:44 +00:00
wtvdec: prevent memory leak in get_tag()
This commit is contained in:
parent
7fb87bc5f2
commit
a572cc8c7a
@ -448,15 +448,20 @@ done:
|
|||||||
|
|
||||||
static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int type, int length)
|
static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int type, int length)
|
||||||
{
|
{
|
||||||
int buf_size = FFMAX(2*length, LEN_PRETTY_GUID) + 1;
|
int buf_size;
|
||||||
char *buf = av_malloc(buf_size);
|
char *buf;
|
||||||
if (!buf)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!strcmp(key, "WM/MediaThumbType")) {
|
if (!strcmp(key, "WM/MediaThumbType")) {
|
||||||
avio_skip(pb, length);
|
avio_skip(pb, length);
|
||||||
return;
|
return;
|
||||||
} else if (type == 0 && length == 4) {
|
}
|
||||||
|
|
||||||
|
buf_size = FFMAX(2*length, LEN_PRETTY_GUID) + 1;
|
||||||
|
buf = av_malloc(buf_size);
|
||||||
|
if (!buf)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (type == 0 && length == 4) {
|
||||||
snprintf(buf, buf_size, "%"PRIi32, avio_rl32(pb));
|
snprintf(buf, buf_size, "%"PRIi32, avio_rl32(pb));
|
||||||
} else if (type == 1) {
|
} else if (type == 1) {
|
||||||
avio_get_str16le(pb, length, buf, buf_size);
|
avio_get_str16le(pb, length, buf, buf_size);
|
||||||
|
Loading…
Reference in New Issue
Block a user