[vlc-devel] [vlc-commits] avcodec: missing initializer (cid #1191736)
Tristan Matthews
le.businessman at gmail.com
Thu Aug 7 17:42:56 CEST 2014
On Mon, Aug 4, 2014 at 6:33 PM, Tristan Matthews
<le.businessman at gmail.com> wrote:
> On Mon, Aug 4, 2014 at 5:35 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
>> Le lundi 4 août 2014, 23:14:30 Tristan Matthews a écrit :
>>> vlc | branch: master | Tristan Matthews <le.businessman at gmail.com> | Mon Aug
>>> 4 17:00:57 2014 -0400| [2da697261ff55dfe4f654ce9a591c3b4d5f98815] |
>>> committer: Tristan Matthews
>>>
>>> avcodec: missing initializer (cid #1191736)
>>
>>>
>>> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2da697261ff55dfe4f6
>>> > 54ce9a591c3b4d5f98815
>>> ---
>>>
>>> modules/codec/avcodec/encoder.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/modules/codec/avcodec/encoder.c
>>> b/modules/codec/avcodec/encoder.c index 0c4f2e4..8f2b898 100644
>>> --- a/modules/codec/avcodec/encoder.c
>>> +++ b/modules/codec/avcodec/encoder.c
>>> @@ -709,7 +709,7 @@ int OpenEncoder( vlc_object_t *p_this )
>>> * Copied from audio.c
>>> */
>>> const unsigned i_order_max = 8 * sizeof(p_context->channel_layout);
>>> - uint32_t pi_order_dst[AOUT_CHAN_MAX];
>>> + uint32_t pi_order_dst[AOUT_CHAN_MAX] = { };
>>
>> Do you care to explain how this fixes anything? I don't see how any error case
>> is handled any better than before.
>
> In aout_CheckChannelReorder, both the channel re-ordering mask and successive
> values of the pi_vlc_chan_order_wg4 array were being compared against
> potentially
> uninitialized values of pi_order_dst. The latter case is more
> problematic since it's the
> loop exit condition.
>
> Another related issue I see here is that pi_order_dst is AOUT_CHAN_MAX (aka 9)
> elements long, whereas pi_vlc_chan_order_wg4 is 10 elements long, so potentially
> pi_order_dst could be read past the end (unless I'm missing something).
>
> Maybe Ilkka would know if pi_order_dst should instead have a length of
> AOUT_CHAN_MAX + 1 (with a 0 as the last element)
> to avoid this?
Actually the loop will break as soon as the last element of
pi_vlc_chan_order_wg4 is reached, so it doesn't matter.
Best,
Tristan
More information about the vlc-devel
mailing list