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

Marton Balint cus at passwd.hu
Wed May 29 23:32:14 CEST 2013


On Wed, 29 May 2013, Reimar Döffinger wrote:

> On Wed, May 29, 2013 at 03:48:46PM +0200, Carl Eugen Hoyos wrote:
>> 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
>
> Slightly different for me on my 64 bit desktop, up to -s 16383x16129
> works.
> Above gives errors from FFmpeg:
> [IMGUTILS @ 0x7f896c072bc0] Picture size 16383x16130 is invalid
>
>> 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
>
> I don't really understand why the issue starts exactly with 2^14 though.

For the width, most probably SDL_Surface->pitch overflows, because it is 
only 16 bit... We should limit the maximum window width to 16383 because 
of the SDL limitation. Because it is only the window size, there is no 
need to exit ffplay.

For the height, XvCreateImage creates a smaller XV image than requested, 
we should detect this somehow, unfortunately the way I see it SDL does not 
expose the real height of the xvideo image, so I can't think of a better 
way than calculating the difference between the pointer of the first two 
data planes, and check if it is big enough...

I will reply to this email with the patches.

Regards,
Marton


More information about the ffmpeg-devel mailing list