[MPlayer-dev-eng] [PATCH] avoid null dereference crash when -edlout w/o vid

Rich Felker dalias at aerifal.cx
Wed May 3 03:12:31 CEST 2006


On Tue, May 02, 2006 at 08:59:20PM -0400, Robert Henney wrote:
> it's seems unfortunate that the EDL Mark command cannot be used on audio
> only material (it could be utilizied as a low-tech way to generate
> timings to a wav file for subtitling purposes, for instance), but it's
> more unfortunate I suppose that a crash results if one attempts to use
> it on material with no video stream.
> 
> the attached patch adds a sanity check that prevents the crash.
> 
> I didn't attempt to go further, but am hoping someone else might. :)

> Index: mplayer.c
> ===================================================================
> RCS file: /cvsroot/mplayer/main/mplayer.c,v
> retrieving revision 1.951
> diff -u -r1.951 mplayer.c
> --- mplayer.c	27 Apr 2006 22:13:59 -0000	1.951
> +++ mplayer.c	3 May 2006 00:43:57 -0000
> @@ -4198,7 +4198,7 @@
>          free(tmp);
>      } break;
>      case MP_CMD_EDL_MARK:
> -      if( edl_fd ) {
> +      if( edl_fd && sh_video != NULL ) {
>  	float v = sh_video->pts;
>  	fprintf( edl_fd, "%f %f %d\n", v-2, v, 0 );
>        }

Try:

float v = sh_video ? sh_video->pts : sh_audio->pts;

Rich




More information about the MPlayer-dev-eng mailing list