summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Allmann <joshua.allmann@gmail.com>2010-06-28 20:27:25 +0000
committerMartin Storsjö <martin@martin.st>2010-06-28 20:27:25 +0000
commit824535e3c6684ba9327eb62d4514deab459a1957 (patch)
tree19860d431255306da782f132c55026f5e1e17350
parent0fecad09fe036eab15d114e898271b57a5650cc5 (diff)
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
-rw-r--r--libavformat/rtpdec.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 74858f638a..38a4c5bd80 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -538,8 +538,14 @@ int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p,
char *attr, char *value))
{
char attr[256];
- char value[4096];
+ char *value;
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
while (*p && *p == ' ') p++; // strip spaces
@@ -548,11 +554,14 @@ int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p,
while (ff_rtsp_next_attr_and_value(&p,
attr, sizeof(attr),
- value, sizeof(value))) {
+ value, value_size)) {
res = parse_fmtp(stream, data, attr, value);
- if (res < 0)
+ if (res < 0 && res != AVERROR_PATCHWELCOME) {
+ av_free(value);
return res;
+ }
}
+ av_free(value);
return 0;
}