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

Rémi Denis-Courmont remi at remlab.net
Sat May 18 18:59:25 CEST 2019


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.

-- 
Rémi Denis-Courmont
http://www.remlab.net/





More information about the vlc-devel mailing list