summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibaut Mattern <tmattern@users.sourceforge.net>2006-09-15 21:52:19 +0000
committerThibaut Mattern <tmattern@users.sourceforge.net>2006-09-15 21:52:19 +0000
commit474c8259a683a8f66e516319942c4714bbe366ae (patch)
treeb24473a2e281c9e6c9a0e3998adb8103757c4c1f
parent16b8ae50b277c6e9f0859589b304fd0d2484152b (diff)
downloadxine-lib-474c8259a683a8f66e516319942c4714bbe366ae.tar.gz
xine-lib-474c8259a683a8f66e516319942c4714bbe366ae.tar.bz2
Fixed potential memory corruption.
Thanks to valgrind ;-) CVS patchset: 8262 CVS date: 2006/09/15 21:52:19
-rw-r--r--src/demuxers/demux_asf.c50
1 files changed, 34 insertions, 16 deletions
diff --git a/src/demuxers/demux_asf.c b/src/demuxers/demux_asf.c
index c95bf5460..b57e28586 100644
--- a/src/demuxers/demux_asf.c
+++ b/src/demuxers/demux_asf.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: demux_asf.c,v 1.181 2006/09/07 07:21:09 tmattern Exp $
+ * $Id: demux_asf.c,v 1.182 2006/09/15 21:52:19 tmattern Exp $
*
* demultiplexer for asf streams
*
@@ -1831,16 +1831,26 @@ static int demux_asf_seek (demux_plugin_t *this_gen,
/* no video stream */
if (this->video_stream == -1) {
- lprintf ("demux_asf_seek: no video stream\n");
- state = 2;
+ if (this->audio_stream == -1) {
+ lprintf ("demux_asf_seek: no video stream, no audio stream\n");
+ return this->status;
+ } else {
+ lprintf ("demux_asf_seek: no video stream\n");
+ state = 2;
+ }
}
/* force the demuxer to not send data to decoders */
- this->streams[this->video_stream].skip = 1;
- this->streams[this->audio_stream].skip = 1;
- this->streams[this->video_stream].resync = 0;
- this->streams[this->audio_stream].resync = 0;
-
+
+ if (this->video_stream >= 0) {
+ this->streams[this->video_stream].skip = 1;
+ this->streams[this->video_stream].resync = 0;
+ }
+ if (this->audio_stream >= 0) {
+ this->streams[this->audio_stream].skip = 1;
+ this->streams[this->audio_stream].resync = 0;
+ }
+
start_pos -= (start_pos - this->first_packet_pos) % this->packet_size;
while ((start_pos >= this->first_packet_pos) && (state != 5)) {
int header_size;
@@ -1922,18 +1932,26 @@ static int demux_asf_seek (demux_plugin_t *this_gen,
}
lprintf ("demux_asf_seek: keyframe_found=%d, keyframe_ts=%lld\n",
this->keyframe_found, this->keyframe_ts);
- this->streams[this->video_stream].resync = 1;
- this->streams[this->video_stream].skip = 1;
- this->streams[this->audio_stream].resync = 1;
- this->streams[this->audio_stream].skip = 1;
+ if (this->video_stream >= 0) {
+ this->streams[this->video_stream].resync = 1;
+ this->streams[this->video_stream].skip = 1;
+ }
+ if (this->audio_stream >= 0) {
+ this->streams[this->audio_stream].resync = 1;
+ this->streams[this->audio_stream].skip = 1;
+ }
} else {
/* "streaming" mode */
this->keyframe_ts = 0;
this->keyframe_found = 0; /* means next keyframe */
- this->streams[this->video_stream].resync = 1;
- this->streams[this->video_stream].skip = 1;
- this->streams[this->audio_stream].resync = 0;
- this->streams[this->audio_stream].skip = 0;
+ if (this->video_stream >= 0) {
+ this->streams[this->video_stream].resync = 1;
+ this->streams[this->video_stream].skip = 1;
+ }
+ if (this->audio_stream >= 0) {
+ this->streams[this->audio_stream].resync = 0;
+ this->streams[this->audio_stream].skip = 0;
+ }
}
return this->status;