[vlc-devel] [PATCH] misc/variables: prevent crash on missing variable

Rémi Denis-Courmont remi at remlab.net
Mon May 20 15:57:46 CEST 2019


Hi,

var_Inherit() callers check for errors. But my point is that caller's caller don't and can't because it is indistinguishable from the default value.

Also because it basically never happens.

This patch hides bugs, making them harder to debug, IMO.

Le 20 mai 2019 09:08:20 GMT+03:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
>On 2019-05-18 18:59, Rémi Denis-Courmont wrote:
>> Le lauantaina 18. toukokuuta 2019, 19.53.23 EEST Marvin Scholz a
>écrit :
>>> From: Filip Roséen <filip at atch.se>
>>>
>>> As var_Inherit will read from the config if the variable is not
>found
>>> in the inherit-chain, the call to (for example) config_GetInt might
>>> crash due to the variable not existing. We might also run into
>>> undefined-behavior if the caller specifies a type which is not
>>> compatible with the underlying config-type.
>>>
>>> This added check fixes the issue by making sure that the type passed
>>> matches that of the configuration, otherwise an error is returned.
>> 
>> This cannot work, because var_Inherit*() calls cannot return an
>error, and
>> call sites accordingly don't expect one.
>
>All var_Inherit() callers check for an error and return a default value
>
>if there is one.
>
>Reading the value of a variable knowing the type is wrong doesn't seem 
>right. I think this patch is OK.
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190520/611594ee/attachment.html>


More information about the vlc-devel mailing list