[vlc-devel] [vlc-commits] block: only do the size test when it's meaningful

Steve Lhomme robux4 at ycbcr.xyz
Wed Jul 11 18:39:13 CEST 2018


On 2018-07-11 18:29, Rémi Denis-Courmont wrote:
> Le keskiviikkona 11. heinäkuuta 2018, 19.22.15 EEST Steve Lhomme a écrit :
>> I think you are confusing 06d86ae4088fd49e69ff6e47c2f6f31e4530f975 and
>> 7a699a45da1e5f622a375cec405b98c3cc5715d3.
> No, I literaly mean that I already explained the cast in the commit that
> introduced it.

The commit that introduced it is 1b4ff7d9782760a05992eae34274c9de249f506f

Which has the following commit message:
* block: fix sign warning

The comment that is above that line predates this commit.

So it may fix a warning but it doesn't mean the case is correct in all 
cases, precisely when uintmax_t and size_t have the same size. In that 
case the uintmax_t can never exceed SIZE_MAX. But if off_t is bigger 
then we'll try to allocate more than SIZE_MAX. Now I don't know if 
there's anything that forbids off_t to be bigger than uintmax_t or not.

>
> -- 
> Rémi Denis-Courmont
> http://www.remlab.net/
>
>
>
> _______________________________________________
> 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