[vlc-devel] [PATCH 09/12] network: io: Remove VLA usages

Thomas Guillem thomas at gllm.fr
Thu Dec 10 13:32:20 CET 2020



On Thu, Dec 10, 2020, at 12:10, Pierre Ynard via vlc-devel wrote:
> > Using VLA for this particular part of the code (http_auth) is very
> > convenient since the size max is bounded, so it can't overflow.
> > 
> > Having said that, we are very close to a full support of MSVC. If
> > we need to fix some well-written code to remove VLA, I'm OK for it.
> > I'm convinced by Steve's arguments. Supporting MSVC can bring more
> > developers in VLC.
> 
> Can we try using some #ifdef and/or converting VLAs to FLAs, rather than
> to heap allocation, where the size is reasonably bounded?

He is a suggestion:

enum auth_param {
    AUTH_PARAM_REALM,
    ...
};

#define AUTH_PARAM_LENMAX 10

static const struct auth_param {
    enum auth_param,
    char str[AUTH_PARAM_LENMAX],
} = {
     AUTH_PARAM_REALM, "realm",
     ...
}

The max size is known.
Then add some bsearch to get the str from the id.

> 
> > Should we vote for VLA removal in VLC ? Via the TC ?
> 
> That seems a bit too forward-leaning to me, this is only the first
> version of the patchset.

The vote won't be about this patchset, but about an agreement for VLA removal in VLC.

> 
> -- 
> Pierre Ynard
> "Une âme dans un corps, c'est comme un dessin sur une feuille de papier."
> _______________________________________________
> 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