Mercurial > libavformat.hg
comparison rtpdec.c @ 6193:da9998b48dff libavformat
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
author | mstorsjo |
---|---|
date | Mon, 28 Jun 2010 20:27:25 +0000 |
parents | c4c35a9d4ab5 |
children | 209c43ef17af |
comparison
equal
deleted
inserted
replaced
6192:b93d7a25cd6b | 6193:da9998b48dff |
---|---|
536 int (*parse_fmtp)(AVStream *stream, | 536 int (*parse_fmtp)(AVStream *stream, |
537 PayloadContext *data, | 537 PayloadContext *data, |
538 char *attr, char *value)) | 538 char *attr, char *value)) |
539 { | 539 { |
540 char attr[256]; | 540 char attr[256]; |
541 char value[4096]; | 541 char *value; |
542 int res; | 542 int res; |
543 int value_size = strlen(p) + 1; | |
544 | |
545 if (!(value = av_malloc(value_size))) { | |
546 av_log(stream, AV_LOG_ERROR, "Failed to allocate data for FMTP."); | |
547 return AVERROR(ENOMEM); | |
548 } | |
543 | 549 |
544 // remove protocol identifier | 550 // remove protocol identifier |
545 while (*p && *p == ' ') p++; // strip spaces | 551 while (*p && *p == ' ') p++; // strip spaces |
546 while (*p && *p != ' ') p++; // eat protocol identifier | 552 while (*p && *p != ' ') p++; // eat protocol identifier |
547 while (*p && *p == ' ') p++; // strip trailing spaces | 553 while (*p && *p == ' ') p++; // strip trailing spaces |
548 | 554 |
549 while (ff_rtsp_next_attr_and_value(&p, | 555 while (ff_rtsp_next_attr_and_value(&p, |
550 attr, sizeof(attr), | 556 attr, sizeof(attr), |
551 value, sizeof(value))) { | 557 value, value_size)) { |
552 | 558 |
553 res = parse_fmtp(stream, data, attr, value); | 559 res = parse_fmtp(stream, data, attr, value); |
554 if (res < 0) | 560 if (res < 0 && res != AVERROR_PATCHWELCOME) { |
561 av_free(value); | |
555 return res; | 562 return res; |
556 } | 563 } |
564 } | |
565 av_free(value); | |
557 return 0; | 566 return 0; |
558 } | 567 } |