mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
gst/base/gsttypefindhelper.c: Fix evil typefind crasher: getrange() might return a short buffer at the end of a file,...
Original commit message from CVS: * gst/base/gsttypefindhelper.c: (helper_find_peek): Fix evil typefind crasher: getrange() might return a short buffer at the end of a file, but gst_type_find_peek() must either return the full data as requested or NULL, but never a short buffer.
This commit is contained in:
parent
d8efd5cc51
commit
2b41c044a2
3 changed files with 30 additions and 2 deletions
|
@ -1,3 +1,11 @@
|
|||
2005-10-09 Tim-Philipp Müller <tim at centricular dot net>
|
||||
|
||||
* gst/base/gsttypefindhelper.c: (helper_find_peek):
|
||||
Fix evil typefind crasher: getrange() might return a short
|
||||
buffer at the end of a file, but gst_type_find_peek() must
|
||||
either return the full data as requested or NULL, but
|
||||
never a short buffer.
|
||||
|
||||
2005-10-09 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* gst/gstmessage.c: (gst_message_new_state_changed),
|
||||
|
|
|
@ -75,8 +75,18 @@ helper_find_peek (gpointer data, gint64 offset, guint size)
|
|||
if (ret != GST_FLOW_OK)
|
||||
goto error;
|
||||
|
||||
find->buffers = g_list_prepend (find->buffers, buffer);
|
||||
/* getrange might silently return shortened buffers at the end of a file,
|
||||
* we must, however, always return either the full requested data or NULL */
|
||||
if (GST_BUFFER_OFFSET (buffer) != offset || GST_BUFFER_SIZE (buffer) < size) {
|
||||
GST_DEBUG ("droping short buffer: %" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT
|
||||
" instead of %" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT,
|
||||
GST_BUFFER_OFFSET (buffer), GST_BUFFER_OFFSET (buffer) +
|
||||
GST_BUFFER_SIZE (buffer), offset, offset + size);
|
||||
gst_buffer_unref (buffer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
find->buffers = g_list_prepend (find->buffers, buffer);
|
||||
return GST_BUFFER_DATA (buffer);
|
||||
|
||||
error:
|
||||
|
|
|
@ -75,8 +75,18 @@ helper_find_peek (gpointer data, gint64 offset, guint size)
|
|||
if (ret != GST_FLOW_OK)
|
||||
goto error;
|
||||
|
||||
find->buffers = g_list_prepend (find->buffers, buffer);
|
||||
/* getrange might silently return shortened buffers at the end of a file,
|
||||
* we must, however, always return either the full requested data or NULL */
|
||||
if (GST_BUFFER_OFFSET (buffer) != offset || GST_BUFFER_SIZE (buffer) < size) {
|
||||
GST_DEBUG ("droping short buffer: %" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT
|
||||
" instead of %" G_GUINT64_FORMAT "-%" G_GUINT64_FORMAT,
|
||||
GST_BUFFER_OFFSET (buffer), GST_BUFFER_OFFSET (buffer) +
|
||||
GST_BUFFER_SIZE (buffer), offset, offset + size);
|
||||
gst_buffer_unref (buffer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
find->buffers = g_list_prepend (find->buffers, buffer);
|
||||
return GST_BUFFER_DATA (buffer);
|
||||
|
||||
error:
|
||||
|
|
Loading…
Reference in a new issue