[FFmpeg-devel] [RFC]Workaround a crash in ffplay / SDL

Carl Eugen Hoyos cehoyos at ag.or.at
Wed May 29 15:48:46 CEST 2013


Hi!

Attached patch is meant to fix / workaround ticket #2428, but with the patch, 
SDL_WaitThread in stream_close() hangs if the condition triggers.

On my system, the following work fine:
$ ffplay -f rawvideo -s 16383x1365 -i /dev/zero
$ ffplay -f rawvideo -s 5593x4000 -i /dev/zero

The following fails as expected with "X Error of failed request:  BadLength":
$ ffplay -f rawvideo -s 16383x1366 -i /dev/zero
$ ffplay -f rawvideo -s 5594x4000 -i /dev/zero

The following crashes here without attached patch similar to the sample in 
ticket #2428:
$ ffplay -f rawvideo -s 16384x1000 -i /dev/zero
$ ffplay -f rawvideo -s 1000x17000 -i /dev/zero

We were able to reproduce the problem on completely different hardware (and 
distribution) on LinuxTag. On a third system, the crash was not reproducible.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/ffplay.c b/ffplay.c
index 5b7fae5..09a6afd 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1070,6 +1070,10 @@ static int video_open(VideoState *is, int force_set_video_mode, VideoPicture *vp
     if (screen && is->width == screen->w && screen->w == w
        && is->height== screen->h && screen->h == h && !force_set_video_mode)
         return 0;
+    if (w >= 16384 || h >= 16384) {
+        fprintf(stderr, "width or height too large - exiting\n");
+        do_exit(is);
+    }
     screen = SDL_SetVideoMode(w, h, 0, flags);
     if (!screen) {
         fprintf(stderr, "SDL: could not set video mode - exiting\n");


More information about the ffmpeg-devel mailing list