diff options
-rw-r--r-- | ext/celt/gstceltdec.c | 5 | ||||
-rw-r--r-- | ext/celt/gstceltenc.c | 13 |
2 files changed, 16 insertions, 2 deletions
diff --git a/ext/celt/gstceltdec.c b/ext/celt/gstceltdec.c index bb4acdfe3..6d3d9433c 100644 --- a/ext/celt/gstceltdec.c +++ b/ext/celt/gstceltdec.c @@ -560,8 +560,11 @@ celt_dec_chain_parse_header (GstCeltDec * dec, GstBuffer * buf) gint error = CELT_OK; /* get the header */ - celt_header_from_packet ((const unsigned char *) GST_BUFFER_DATA (buf), + error = + celt_header_from_packet ((const unsigned char *) GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf), &dec->header); + if (error < 0) + goto invalid_header; if (memcmp (dec->header.codec_id, "CELT ", 8) != 0) goto invalid_header; diff --git a/ext/celt/gstceltenc.c b/ext/celt/gstceltenc.c index 2b09238d2..9e6944df0 100644 --- a/ext/celt/gstceltenc.c +++ b/ext/celt/gstceltenc.c @@ -914,7 +914,11 @@ gst_celt_enc_chain (GstPad * pad, GstBuffer * buf) unsigned char *data = g_malloc (header_size); /* create header buffer */ - celt_header_to_packet (&enc->header, data, header_size); + int error = celt_header_to_packet (&enc->header, data, header_size); + if (error < 0) { + g_free (data); + goto no_header; + } buf1 = gst_celt_enc_buffer_from_data (enc, data, header_size, 0); /* create comment buffer */ @@ -1047,6 +1051,13 @@ not_setup: goto done; } +no_header: + { + GST_ELEMENT_ERROR (enc, STREAM, ENCODE, (NULL), + ("Failed to encode header")); + ret = GST_FLOW_ERROR; + goto done; + } } |