[MPlayer-dev-eng] [PATCH] Fix segfault with -chapter
Arne Bochem
arneb.mp at ccan.de
Tue Nov 5 21:21:44 CET 2013
When running:
mplayer -chapter 2 foo.mkv
(ASS enabled.)
The following crash occurs:
Program received signal SIGSEGV, Segmentation fault.
0x00005555556b573c in seek (mpctx=mpctx at entry=0x555556506ae0, amount=..., style=style at entry=1) at mplayer.c:2749
2749 if (ass_enabled && mpctx->d_sub->sh && ((sh_sub_t *)mpctx->d_sub->sh)->ass_track)
(gdb) bt
#0 0x00005555556b573c in seek (mpctx=mpctx at entry=0x555556506ae0, amount=..., style=style at entry=1) at mplayer.c:2749
#1 0x00005555556a8322 in main (argc=4, argv=0x7fffffffdfe8) at mplayer.c:3429
(gdb) print mpctx->d_sub
$1 = (demux_stream_t *) 0x0
Fixed by moving -chapter seeking below the place where mpctx->d_sub is
initialized.
Regards,
Arne Bochem
-------------- next part --------------
Index: mplayer.c
===================================================================
--- mplayer.c (revision 36500)
+++ mplayer.c (working copy)
@@ -3423,11 +3423,6 @@
if (!mpctx->demuxer)
goto goto_next_file;
- if (dvd_chapter > 1) {
- float pts;
- if (demuxer_seek_chapter(mpctx->demuxer, dvd_chapter - 1, 1, &pts, NULL, NULL) >= 0 && pts > -1.0)
- seek(mpctx, pts, SEEK_ABSOLUTE);
- }
initialized_flags |= INITIALIZED_DEMUXER;
@@ -3450,6 +3445,12 @@
mpctx->d_video = mpctx->demuxer->video;
mpctx->d_sub = mpctx->demuxer->sub;
+ if (dvd_chapter > 1) {
+ float pts;
+ if (demuxer_seek_chapter(mpctx->demuxer, dvd_chapter - 1, 1, &pts, NULL, NULL) >= 0 && pts > -1.0)
+ seek(mpctx, pts, SEEK_ABSOLUTE);
+ }
+
if (ts_prog) {
int tmp = ts_prog;
mp_property_do("switch_program", M_PROPERTY_SET, &tmp, mpctx);
More information about the MPlayer-dev-eng
mailing list