mpegvideoparse: fix crash if downstream is unliked

mpeg_packetizer_get_block() in some circumstances (here: if
downstream was unlinked) returns a block but does not set the
buffer causing mpegvideoparse_drain_avail() to cause invalid memory
access.

Fixes #619502.
This commit is contained in:
Zaheer Abbas Merali 2010-05-25 00:27:17 +01:00 committed by Tim-Philipp Müller
parent c6e77c3d03
commit 721643431e
2 changed files with 6 additions and 1 deletions

View file

@ -412,6 +412,11 @@ mpeg_packetiser_get_block (MPEGPacketiser * p, GstBuffer ** buf)
p->adapter_offset += block->length;
GST_BUFFER_TIMESTAMP (*buf) = block->ts;
} else {
GST_DEBUG ("we have a block but do not meet all conditions buf: %p "
"block length: %d adapter offset %" G_GUINT64_FORMAT " block offset "
"%" G_GUINT64_FORMAT, buf, block->length, p->adapter_offset,
block->offset);
}
return block;
}

View file

@ -493,7 +493,7 @@ mpegvideoparse_drain_avail (MpegVideoParse * mpegvideoparse)
cur->length, picture_start_code_name (cur->first_pack_type),
cur->flags);
if (cur->flags & MPEG_BLOCK_FLAG_SEQUENCE) {
if ((cur->flags & MPEG_BLOCK_FLAG_SEQUENCE) && buf != NULL) {
/* Found a sequence header */
if (!mpegvideoparse_handle_sequence (mpegvideoparse, buf)) {
GST_DEBUG_OBJECT (mpegvideoparse,