[vlc-devel] [vlc-commits] packetizer: mpegvideo: parse color details if present

Filipe Cabecinhas scee at filcab.net
Sat Apr 23 22:57:14 CEST 2016


> On 23 Apr 2016, at 12:17, Ilkka Ollakka <ileoo at videolan.org> wrote:
> 
> On Mon, Apr 18, 2016 at 02:43:01PM +0200, Rémi Denis-Courmont wrote:
>> Le 2016-04-18 14:18, git at videolan.org a écrit :
>>> +            int8_t color_primaries = p_frag->p_buffer[5];
>>> +            int8_t color_transfer  = p_frag->p_buffer[6];
>>> +            int8_t color_matrix    = p_frag->p_buffer[7];
> 
>> This is UB if byte values have high order bit set.
> 
> Hi,
> 
> Sorry I'm not quite sure what you mean. If they have high order bit set
> they go negative values, but those bitstreams are anyway out of bounds
> what is defined to be valid and present.
> 
> If you mean that there can be some other issue to put value to int8_t
> from buffer, I can fix the issue if you can give pointer on issue.

Rémi is talking about the C99 standard. You’re converting a uint8_t (from 0x00 to 0xff) into an int8_t. The value in the uint8_t may be out of range of the new type, which would trigger Undefined Behaviour.
It *might* seem to work, but that’s not enough.

Thank you,

  Filipe

> 
> -- 
> Ilkka Ollakka
> Q:	What is the difference between Texas and yogurt?
> A:	Yogurt has culture.
> _______________________________________________
> 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