Please ignore this patch. It was sent by mistake.

I‘ve send a corrected version separately.

Sorry for the noise.

> 2026年5月6日 12:33,xiaozhuai <[email protected]> 写道:
> 
> libavformat/cbs.c includes this file with a different set of CBS_*
> macros. In configurations using --disable-everything, all coded
> bitstream types may be disabled for that instance, leaving
> cbs_type_table empty.
> 
> This triggers a zero-sized array warning with MSVC and may lead to an
> internal compiler error with optimization enabled.
> 
> Add a NULL terminator and iterate until the terminator instead of using
> FF_ARRAY_ELEMS(). The runtime behavior is unchanged.
> 
> The code currently permits building an instance of cbs.c with no enabled
> coded bitstream types. In that case the generated table is empty. Make
> the table explicitly NULL-terminated so this configuration is valid C
> for compilers that reject or mishandle empty arrays.
> 
> Signed-off-by: xiaozhuai <[email protected]>
> ---
> libavcodec/cbs.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
> index 7ff0f89aa5..7357c0f9ac 100644
> --- a/libavcodec/cbs.c
> +++ b/libavcodec/cbs.c
> @@ -61,6 +61,7 @@ static const CodedBitstreamType *const cbs_type_table[] = {
> #if CBS_VP9
>     &CBS_FUNC(type_vp9),
> #endif
> +    NULL
> };
> 
> const enum AVCodecID CBS_FUNC(all_codec_ids)[] = {
> @@ -105,7 +106,7 @@ av_cold int CBS_FUNC(init)(CodedBitstreamContext 
> **ctx_ptr,
>     int i;
> 
>     type = NULL;
> -    for (i = 0; i < FF_ARRAY_ELEMS(cbs_type_table); i++) {
> +    for (i = 0; cbs_type_table[i]; i++) {
>         if (cbs_type_table[i]->codec_id == codec_id) {
>             type = cbs_type_table[i];
>             break;
> -- 
> 2.54.0
> 

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to