[vlc-devel] New Defects reported by Coverity Scan for vlc

Steve Lhomme robux4 at ycbcr.xyz
Wed Aug 22 15:37:28 CEST 2018


On 21/08/2018 16:33, Thomas Guillem wrote:
> On Tue, Aug 21, 2018, at 16:21, Romain Vimont wrote:
>> On Tue, Aug 21, 2018 at 04:59:43PM +0300, Rémi Denis-Courmont wrote:
>>> Le tiistaina 21. elokuuta 2018, 11.12.06 EEST Romain Vimont a écrit :
>>>> False-positive?
>>>>
>>>> In vlc_list.h:
>>>>
>>>>      #define vlc_list_entry_p(node, p, member) \
>>>>          (0 ? (p) : (void *)(((char *)(node)) - vlc_list_offset_p(p,
>>>> member)))
>>>>
>>>> Just for info, why "0 ? (p) : XXX" here?
>>> Conversion to type of p.

Maybe that was the intention but p is actually a pointer to some struct. 
So at best it's a conversion to a pointer of p's type. Which is in line 
with the cast to (void*) in the following expression.

Now looking at C11 
(http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf section 
6.5.15) and C++11 
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1905.pdf 
section 5.16) between p* and void*, void* is always picked. So the 
ternary operator doesn't help at all. We always end up with a void*.

Same thing with vlc_list_entry_dummy().

>> Thank you.
>>
>> This could deserve a comment :)
> +1
>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel



More information about the vlc-devel mailing list