gst/mpegstream/: Fix memmory corruption due to not storing the new updated pointer after a g_renew(). Fixes #558896.

Original commit message from CVS:
Patch by: Tal Shalif <tshalif at nargila dot org>
* gst/mpegstream/gstdvddemux.c:
(gst_dvd_demux_get_subpicture_stream):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_get_video_stream),
(gst_mpeg_demux_get_audio_stream):
Fix memmory corruption due to not storing the new updated pointer
after a g_renew(). Fixes #558896.
This commit is contained in:
Tal Shalif 2008-11-03 11:31:49 +00:00 committed by Wim Taymans
parent 1992a43350
commit 099e716a61
3 changed files with 19 additions and 7 deletions

View file

@ -1,3 +1,14 @@
2008-11-03 Wim Taymans <wim.taymans@collabora.co.uk>
Patch by: Tal Shalif <tshalif at nargila dot org>
* gst/mpegstream/gstdvddemux.c:
(gst_dvd_demux_get_subpicture_stream):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_get_video_stream),
(gst_mpeg_demux_get_audio_stream):
Fix memmory corruption due to not storing the new updated pointer
after a g_renew(). Fixes #558896.
2008-10-30 Stefan Kost <ensonic@users.sf.net> 2008-10-30 Stefan Kost <ensonic@users.sf.net>
* tests/check/Makefile.am: * tests/check/Makefile.am:

View file

@ -710,14 +710,14 @@ gst_dvd_demux_get_subpicture_stream (GstMPEGDemux * mpeg_demux,
str->type = GST_DVD_DEMUX_SUBP_UNKNOWN; str->type = GST_DVD_DEMUX_SUBP_UNKNOWN;
g_free (name); g_free (name);
add_pad = TRUE; add_pad = TRUE;
dvd_demux->subpicture_stream[stream_nr] = str;
} else { } else {
/* This stream may have been created by a derived class, reset the /* This stream may have been created by a derived class, reset the
size. */ size. */
str = g_renew (GstMPEGStream, str, 1); str = g_renew (GstMPEGStream, str, 1);
} }
dvd_demux->subpicture_stream[stream_nr] = str;
if (str->type != GST_DVD_DEMUX_SUBP_DVD) { if (str->type != GST_DVD_DEMUX_SUBP_DVD) {
/* We need to set new caps for this pad. */ /* We need to set new caps for this pad. */
str->caps = gst_caps_new_simple ("video/x-dvd-subpicture", NULL); str->caps = gst_caps_new_simple ("video/x-dvd-subpicture", NULL);

View file

@ -358,16 +358,16 @@ gst_mpeg_demux_get_video_stream (GstMPEGDemux * mpeg_demux,
CLASS (mpeg_demux)->video_template); CLASS (mpeg_demux)->video_template);
g_free (name); g_free (name);
mpeg_demux->video_stream[stream_nr] = str;
set_caps = TRUE; set_caps = TRUE;
} else { } else {
/* This stream may have been created by a derived class, reset the /* This stream may have been created by a derived class, reset the
size. */ size. */
video_str = g_renew (GstMPEGVideoStream, str, 1); video_str = g_renew (GstMPEGVideoStream, str, 1);
mpeg_demux->video_stream[stream_nr] = str = (GstMPEGStream *) video_str; str = (GstMPEGStream *) video_str;
} }
mpeg_demux->video_stream[stream_nr] = str;
if (set_caps || video_str->mpeg_version != mpeg_version) { if (set_caps || video_str->mpeg_version != mpeg_version) {
gchar *codec; gchar *codec;
GstTagList *list; GstTagList *list;
@ -416,6 +416,7 @@ gst_mpeg_demux_get_audio_stream (GstMPEGDemux * mpeg_demux,
type < GST_MPEG_DEMUX_AUDIO_LAST, NULL); type < GST_MPEG_DEMUX_AUDIO_LAST, NULL);
str = mpeg_demux->audio_stream[stream_nr]; str = mpeg_demux->audio_stream[stream_nr];
if (str && str->type != type) { if (str && str->type != type) {
gst_element_remove_pad (GST_ELEMENT (mpeg_demux), str->pad); gst_element_remove_pad (GST_ELEMENT (mpeg_demux), str->pad);
g_free (str); g_free (str);
@ -430,8 +431,6 @@ gst_mpeg_demux_get_audio_stream (GstMPEGDemux * mpeg_demux,
CLASS (mpeg_demux)->audio_template); CLASS (mpeg_demux)->audio_template);
g_free (name); g_free (name);
mpeg_demux->audio_stream[stream_nr] = str;
/* new pad, set caps */ /* new pad, set caps */
set_caps = TRUE; set_caps = TRUE;
} else { } else {
@ -440,6 +439,8 @@ gst_mpeg_demux_get_audio_stream (GstMPEGDemux * mpeg_demux,
str = g_renew (GstMPEGStream, str, 1); str = g_renew (GstMPEGStream, str, 1);
} }
mpeg_demux->audio_stream[stream_nr] = str;
if (set_caps) { if (set_caps) {
GstTagList *list; GstTagList *list;