[vlc-devel] [PATCH] picture_pool: don't crash for pictures not coming from a picture pool

Steve Lhomme robux4 at ycbcr.xyz
Fri Mar 16 08:23:51 CET 2018


Le 15/03/2018 à 18:44, Rémi Denis-Courmont a écrit :
> Le torstaina 15. maaliskuuta 2018, 10.49.01 EET Steve Lhomme a écrit :
>> ie pictures coming from picture_NewFromResource()
>> ---
>>   src/misc/picture_pool.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/src/misc/picture_pool.c b/src/misc/picture_pool.c
>> index 7b5a82bfba..4b267ead4c 100644
>> --- a/src/misc/picture_pool.c
>> +++ b/src/misc/picture_pool.c
>> @@ -303,6 +303,8 @@ bool picture_pool_OwnsPic(picture_pool_t *pool,
>> picture_t *pic) while (priv->gc.destroy != picture_pool_ReleasePicture) {
>>           pic = priv->gc.opaque;
>>           priv = (picture_priv_t *)pic;
>> +        if (pic == NULL)
>> +            return false;
>>       }
>>
>>       uintptr_t sys = (uintptr_t)priv->gc.opaque;
> It works with the current narrow set of uses of gc.opaque, but that does not
> look sane in the long run.

This whole function may go away with how we plan to do things in 4.0 but 
for now it fixes a crash I had. It is happening when the pool has no 
picture left and it allocates an extra picture on the fly, not 
associated with any pool. It can happen in the current code if using 
many filters (more than 3 I suppose) and maybe other cases.


More information about the vlc-devel mailing list