mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 00:31:13 +00:00
mpegtspacketizer: catch section lengths extending past the buffer length
This is probably the cause for an occasional crash while streaming
MPEG. Blind fix after staring at the code and following logic, so
may or may not fix the issue, I cannot test.
(Port of 4275a70cb5
from mpegdemux)
This commit is contained in:
parent
58a210e3d3
commit
5c2e6dc512
1 changed files with 6 additions and 0 deletions
|
@ -2356,6 +2356,12 @@ mpegts_packetizer_push_section (MpegTSPacketizer2 * packetizer,
|
||||||
if (packet->pid == 0x14) {
|
if (packet->pid == 0x14) {
|
||||||
table_id = data[0];
|
table_id = data[0];
|
||||||
section->section_length = GST_READ_UINT24_BE (data) & 0x000FFF;
|
section->section_length = GST_READ_UINT24_BE (data) & 0x000FFF;
|
||||||
|
if (data - GST_BUFFER_DATA (packet->buffer) + section->section_length + 3 >
|
||||||
|
GST_BUFFER_SIZE (packet->buffer)) {
|
||||||
|
GST_WARNING ("PID %dd PSI section length extends past the end "
|
||||||
|
"of the buffer", packet->pid);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
section->buffer = gst_buffer_create_sub (packet->buffer,
|
section->buffer = gst_buffer_create_sub (packet->buffer,
|
||||||
data - GST_BUFFER_DATA (packet->buffer), section->section_length + 3);
|
data - GST_BUFFER_DATA (packet->buffer), section->section_length + 3);
|
||||||
section->table_id = table_id;
|
section->table_id = table_id;
|
||||||
|
|
Loading…
Reference in a new issue