summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--src/input/libreal/sdpplin.c51
2 files changed, 33 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 21192d723..0f0d31b61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,8 @@ xine-lib (1.1.4)
exhaustion of memory; patch by Matthias Drochner. [bug #1620339]
* Fix invalid memory access in Real Media ASM parser; reported by Roland
Kay. [bug #1603503]
+ * Fix program termination due to invalid Real Media SDP; reported by Roland
+ Kay. [bug #1602663]
xine-lib (1.1.3)
* Security fixes:
diff --git a/src/input/libreal/sdpplin.c b/src/input/libreal/sdpplin.c
index e77781253..dc83c3ee1 100644
--- a/src/input/libreal/sdpplin.c
+++ b/src/input/libreal/sdpplin.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: sdpplin.c,v 1.6 2006/06/20 01:07:58 dgp85 Exp $
+ * $Id: sdpplin.c,v 1.7 2006/12/25 16:12:17 dgp85 Exp $
*
* sdp/sdpplin parser.
*
@@ -71,8 +71,9 @@ static char *b64_decode(const char *in, char *out, int *size)
int c = in[i+j];
if (dtable[c] & 0x80) {
- printf("Illegal character '%c' in input.\n", c);
- exit(1);
+ fprintf(stderr, "Illegal character '%c' in input.\n", c);
+ *size = 0;
+ return NULL;
}
a[i] = (char) c;
b[i] = (char) dtable[c];
@@ -200,11 +201,13 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) {
if(filter(*data,"a=OpaqueData:buffer;",&buf)) {
decoded = b64_decode(buf, decoded, &(desc->mlti_data_size));
- desc->mlti_data = malloc(sizeof(char)*desc->mlti_data_size);
- memcpy(desc->mlti_data, decoded, desc->mlti_data_size);
- handled=1;
- *data=nl(*data);
- lprintf("mlti_data_size: %i\n", desc->mlti_data_size);
+ if ( decoded != NULL ) {
+ desc->mlti_data = malloc(sizeof(char)*desc->mlti_data_size);
+ memcpy(desc->mlti_data, decoded, desc->mlti_data_size);
+ handled=1;
+ *data=nl(*data);
+ lprintf("mlti_data_size: %i\n", desc->mlti_data_size);
+ }
}
if(filter(*data,"a=ASMRuleBook:string;",&buf)) {
@@ -252,30 +255,38 @@ sdpplin_t *sdpplin_parse(char *data) {
if(filter(data,"a=Title:buffer;",&buf)) {
decoded=b64_decode(buf, decoded, &len);
- desc->title=strdup(decoded);
- handled=1;
- data=nl(data);
+ if ( decoded != NULL ) {
+ desc->title=strdup(decoded);
+ handled=1;
+ data=nl(data);
+ }
}
if(filter(data,"a=Author:buffer;",&buf)) {
decoded=b64_decode(buf, decoded, &len);
- desc->author=strdup(decoded);
- handled=1;
- data=nl(data);
+ if ( decoded != NULL ) {
+ desc->author=strdup(decoded);
+ handled=1;
+ data=nl(data);
+ }
}
if(filter(data,"a=Copyright:buffer;",&buf)) {
decoded=b64_decode(buf, decoded, &len);
- desc->copyright=strdup(decoded);
- handled=1;
- data=nl(data);
+ if ( decoded != NULL ) {
+ desc->copyright=strdup(decoded);
+ handled=1;
+ data=nl(data);
+ }
}
if(filter(data,"a=Abstract:buffer;",&buf)) {
decoded=b64_decode(buf, decoded, &len);
- desc->abstract=strdup(decoded);
- handled=1;
- data=nl(data);
+ if ( decoded != NULL ) {
+ desc->abstract=strdup(decoded);
+ handled=1;
+ data=nl(data);
+ }
}
if(filter(data,"a=StreamCount:integer;",&buf)) {