Commit a37616d4 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller
Browse files

ext/theora/theoraenc.c: Check return value of theora_encode_header(), or we...

ext/theora/theoraenc.c: Check return value of theora_encode_header(), or we might try to allocate a random number of ...

Original commit message from CVS:
* ext/theora/theoraenc.c: (theora_enc_chain):
Check return value of theora_encode_header(), or we might try to
allocate a random number of bytes. theora_encode_header() can fail
if libtheora has been compiled with encoding support disabled.
Fixes #398110.
parent d49920f3
2007-01-29 Tim-Philipp Müller <tim at centricular dot net>
* ext/theora/theoraenc.c: (theora_enc_chain):
Check return value of theora_encode_header(), or we might try to
allocate a random number of bytes. theora_encode_header() can fail
if libtheora has been compiled with encoding support disabled.
Fixes #398110.
2007-01-29 Wim Taymans <wim@fluendo.com>
* tests/check/gst/.cvsignore:
......@@ -626,7 +626,9 @@ theora_enc_chain (GstPad * pad, GstBuffer * buffer)
libtheora handles the additional Ogg bitstream constraints */
/* first packet will get its own page automatically */
theora_encode_header (&enc->state, &op);
if (theora_encode_header (&enc->state, &op) != 0)
goto encoder_disabled;
ret = theora_buffer_from_packet (enc, &op, GST_CLOCK_TIME_NONE,
GST_CLOCK_TIME_NONE, &buf1);
if (ret != GST_FLOW_OK) {
......@@ -637,7 +639,9 @@ theora_enc_chain (GstPad * pad, GstBuffer * buffer)
theora_comment_clear (&enc->comment);
theora_comment_init (&enc->comment);
theora_encode_comment (&enc->comment, &op);
if (theora_encode_comment (&enc->comment, &op) != 0)
goto encoder_disabled;
ret = theora_buffer_from_packet (enc, &op, GST_CLOCK_TIME_NONE,
GST_CLOCK_TIME_NONE, &buf2);
/* Theora expects us to put this packet buffer into an ogg page,
......@@ -652,7 +656,9 @@ theora_enc_chain (GstPad * pad, GstBuffer * buffer)
goto header_buffer_alloc;
}
theora_encode_tables (&enc->state, &op);
if (theora_encode_tables (&enc->state, &op) != 0)
goto encoder_disabled;
ret = theora_buffer_from_packet (enc, &op, GST_CLOCK_TIME_NONE,
GST_CLOCK_TIME_NONE, &buf3);
if (ret != GST_FLOW_OK) {
......@@ -893,6 +899,13 @@ data_push:
gst_buffer_unref (buffer);
return ret;
}
encoder_disabled:
{
GST_ELEMENT_ERROR (enc, STREAM, ENCODE, (NULL),
("libtheora has been compiled with the encoder disabled"));
gst_buffer_unref (buffer);
return GST_FLOW_ERROR;
}
}
static GstStateChangeReturn
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment