mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 06:16:36 +00:00
celt: a bit more error checking on header parsing
https://bugzilla.gnome.org/show_bug.cgi?id=659087
This commit is contained in:
parent
d8684fffa1
commit
fe0a2ec885
2 changed files with 16 additions and 2 deletions
|
@ -560,8 +560,11 @@ celt_dec_chain_parse_header (GstCeltDec * dec, GstBuffer * buf)
|
||||||
gint error = CELT_OK;
|
gint error = CELT_OK;
|
||||||
|
|
||||||
/* get the header */
|
/* get the header */
|
||||||
|
error =
|
||||||
celt_header_from_packet ((const unsigned char *) GST_BUFFER_DATA (buf),
|
celt_header_from_packet ((const unsigned char *) GST_BUFFER_DATA (buf),
|
||||||
GST_BUFFER_SIZE (buf), &dec->header);
|
GST_BUFFER_SIZE (buf), &dec->header);
|
||||||
|
if (error < 0)
|
||||||
|
goto invalid_header;
|
||||||
|
|
||||||
if (memcmp (dec->header.codec_id, "CELT ", 8) != 0)
|
if (memcmp (dec->header.codec_id, "CELT ", 8) != 0)
|
||||||
goto invalid_header;
|
goto invalid_header;
|
||||||
|
|
|
@ -914,7 +914,11 @@ gst_celt_enc_chain (GstPad * pad, GstBuffer * buf)
|
||||||
unsigned char *data = g_malloc (header_size);
|
unsigned char *data = g_malloc (header_size);
|
||||||
|
|
||||||
/* create header buffer */
|
/* 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);
|
buf1 = gst_celt_enc_buffer_from_data (enc, data, header_size, 0);
|
||||||
|
|
||||||
/* create comment buffer */
|
/* create comment buffer */
|
||||||
|
@ -1047,6 +1051,13 @@ not_setup:
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
no_header:
|
||||||
|
{
|
||||||
|
GST_ELEMENT_ERROR (enc, STREAM, ENCODE, (NULL),
|
||||||
|
("Failed to encode header"));
|
||||||
|
ret = GST_FLOW_ERROR;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue