Commit f4a39cee authored by Clément Bœsch's avatar Clément Bœsch

Merge commit '24130234'

* commit '24130234':
  rtpdec_mpeg4: validate fmtp fields

Merged with fixed log message.
Merged-by: 's avatarClément Bœsch <u@pkh.me>
parents 206a9fb2 24130234
...@@ -289,11 +289,22 @@ static int parse_fmtp(AVFormatContext *s, ...@@ -289,11 +289,22 @@ static int parse_fmtp(AVFormatContext *s,
for (i = 0; attr_names[i].str; ++i) { for (i = 0; attr_names[i].str; ++i) {
if (!av_strcasecmp(attr, attr_names[i].str)) { if (!av_strcasecmp(attr, attr_names[i].str)) {
if (attr_names[i].type == ATTR_NAME_TYPE_INT) { if (attr_names[i].type == ATTR_NAME_TYPE_INT) {
int val = atoi(value);
if (val > 32) {
av_log(s, AV_LOG_ERROR,
"The %s field size is invalid (%d)\n",
attr, val);
return AVERROR_INVALIDDATA;
}
*(int *)((char *)data+ *(int *)((char *)data+
attr_names[i].offset) = atoi(value); attr_names[i].offset) = val;
} else if (attr_names[i].type == ATTR_NAME_TYPE_STR) } else if (attr_names[i].type == ATTR_NAME_TYPE_STR) {
char *val = av_strdup(value);
if (!val)
return AVERROR(ENOMEM);
*(char **)((char *)data+ *(char **)((char *)data+
attr_names[i].offset) = av_strdup(value); attr_names[i].offset) = val;
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment