From ce7df5b3824d61862dadc964a663f5837f1bb1a2 Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Tue, 24 Aug 2004 18:25:02 +0000 Subject: gst-libs/gst/riff/riff-read.c: fix infinite loop in wavparse, fixes bug Original commit message from CVS: 2004-08-24 Sebastien Cote * gst-libs/gst/riff/riff-read.c: (gst_riff_peek_head), (gst_riff_read_element_data), (gst_riff_read_seek), (gst_riff_read_skip): fix infinite loop in wavparse, fixes bug #144616, patch reviewed by Ronald and committed by Christophe Fergeau --- ChangeLog | 8 ++++++++ gst-libs/gst/riff/riff-read.c | 14 +++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index e7f2e394..35f72a0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2004-08-24 Sebastien Cote + + * gst-libs/gst/riff/riff-read.c: (gst_riff_peek_head), + (gst_riff_read_element_data), (gst_riff_read_seek), + (gst_riff_read_skip): fix infinite loop in wavparse, fixes bug + #144616, patch reviewed by Ronald and committed by Christophe Fergeau + + 2004-08-23 Iain * ext/mad/gstid3tag.c (gst_mad_id3_to_tag_list): Special case COMM diff --git a/gst-libs/gst/riff/riff-read.c b/gst-libs/gst/riff/riff-read.c index 11740f2a..3cfe634a 100644 --- a/gst-libs/gst/riff/riff-read.c +++ b/gst-libs/gst/riff/riff-read.c @@ -179,7 +179,7 @@ gst_riff_peek_head (GstRiffRead * riff, /* Here, we might encounter EOS */ gst_bytestream_get_status (riff->bs, &remaining, &event); - if (GST_IS_EVENT (event)) { + if (event && GST_IS_EVENT (event)) { gboolean eos = (GST_EVENT_TYPE (event) == GST_EVENT_EOS); gst_pad_event_default (riff->sinkpad, event); @@ -220,7 +220,7 @@ gst_riff_read_element_data (GstRiffRead * riff, guint length, guint * got_bytes) guint32 remaining; gst_bytestream_get_status (riff->bs, &remaining, &event); - if (GST_IS_EVENT (event)) { + if (event && GST_IS_EVENT (event)) { gst_pad_event_default (riff->sinkpad, event); if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) { @@ -276,8 +276,8 @@ gst_riff_read_seek (GstRiffRead * riff, guint64 offset) gst_bytestream_get_status (riff->bs, &remaining, &event); if (event) { g_warning ("Unexpected event before seek"); - gst_event_unref (event); } + if (remaining) gst_bytestream_flush_fast (riff->bs, remaining); @@ -376,9 +376,13 @@ gst_riff_read_skip (GstRiffRead * riff) /* see if we have that much data available */ gst_bytestream_get_status (riff->bs, &remaining, &event); - if (event) { + if (event && GST_IS_EVENT (event)) { + gboolean eos = (GST_EVENT_TYPE (event) == GST_EVENT_EOS); + g_warning ("Unexpected event in skip"); - gst_event_unref (event); + gst_pad_event_default (riff->sinkpad, event); + if (eos) + return FALSE; } /* yes */ -- cgit v1.2.1