Commit 824535e3 authored by Josh Allmann's avatar Josh Allmann Committed by Martin Storsjö

rtpdec: Malloc the fmtp value buffer

This allows very large value strings, needed for xiph extradata.

Patch by Josh Allmann, joshua dot allmann at gmail

Originally committed as revision 23859 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 0fecad09
...@@ -538,8 +538,14 @@ int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p, ...@@ -538,8 +538,14 @@ int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p,
char *attr, char *value)) char *attr, char *value))
{ {
char attr[256]; char attr[256];
char value[4096]; char *value;
int res; int res;
int value_size = strlen(p) + 1;
if (!(value = av_malloc(value_size))) {
av_log(stream, AV_LOG_ERROR, "Failed to allocate data for FMTP.");
return AVERROR(ENOMEM);
}
// remove protocol identifier // remove protocol identifier
while (*p && *p == ' ') p++; // strip spaces while (*p && *p == ' ') p++; // strip spaces
...@@ -548,11 +554,14 @@ int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p, ...@@ -548,11 +554,14 @@ int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p,
while (ff_rtsp_next_attr_and_value(&p, while (ff_rtsp_next_attr_and_value(&p,
attr, sizeof(attr), attr, sizeof(attr),
value, sizeof(value))) { value, value_size)) {
res = parse_fmtp(stream, data, attr, value); res = parse_fmtp(stream, data, attr, value);
if (res < 0) if (res < 0 && res != AVERROR_PATCHWELCOME) {
av_free(value);
return res; return res;
}
} }
av_free(value);
return 0; return 0;
} }
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