Comment
The patch is a compatibility refactor for FFmpeg codec capability queries, replacing direct access to codec->ch_layouts / supported_samplerates / sample_fmts with avcodec_get_supported_config() and adjusting some types/formatting. I do not see any added network access, privilege escalation, persistence, or packaging-time execution. The new code only reads codec metadata and populates in-memory structures; the main risk is potential build/runtime compatibility issues with FFmpeg API changes, not a security issue. No malicious behavior is evident in this diff.
@@ -0,0 +1,187 @@
+--- a/libffabi/src/ffabi.c 2026-08-14 21:05:19.511652228 -0600
++++ b/libffabi/src/ffabi.c 2026-08-14 21:04:32.531358307 -0600
+@@ -531,90 +531,149 @@
+ {
+ char* exinfo;
+ size_t len;
+- unsigned int count_ch_layouts_in = 0;
++ int count_ch_layouts_in = 0;
+ unsigned int count_ch_layouts_out = 0;
+- uint64_t* channel_layouts;
++ uint64_t* channel_layouts;
++ const AVChannelLayout* ch_layouts = NULL;
+ unsigned int i;
++ int ret;
+
+ len = strlen(codec->name);
+ if (len >= FFM_CODEC_INFO_NAME_MAX_LENGTH) return -1;
+
+- if (NULL != codec->ch_layouts) {
+- while (0 != codec->ch_layouts[count_ch_layouts_in].nb_channels)
+- {
+- count_ch_layouts_in++;
+- }
+- }
++ ret = avcodec_get_supported_config(
++ NULL, codec, AV_CODEC_CONFIG_CHANNEL_LAYOUT, 0,
++ (const void**)&ch_layouts, &count_ch_layouts_in
++ );
++
++ if (ret < 0) return -1;
++
++ exinfo = (char*)ffabi_memalign(
++ sizeof(uint64_t),
++ FFM_CODEC_INFO_NAME_MAX_LENGTH +
++ FFM_CODEC_INFO_EXMARK_LENGTH +
++ ((count_ch_layouts_in + 1) * sizeof(uint64_t))
++ );
+
+- exinfo = (char*)ffabi_memalign(sizeof(uint64_t), (FFM_CODEC_INFO_NAME_MAX_LENGTH + FFM_CODEC_INFO_EXMARK_LENGTH + ((count_ch_layouts_in+1)*sizeof(uint64_t))));
+ if (NULL == exinfo) return -1;
+
+ memcpy(exinfo, codec->name, len + 1);
+- memcpy(exinfo + FFM_CODEC_INFO_NAME_MAX_LENGTH, FFM_CODEC_INFO_EXMARK_MAGIC, FFM_CODEC_INFO_EXMARK_LENGTH);
+- channel_layouts = (uint64_t*)(exinfo + FFM_CODEC_INFO_NAME_MAX_LENGTH + FFM_CODEC_INFO_EXMARK_LENGTH);
++ memcpy(exinfo + FFM_CODEC_INFO_NAME_MAX_LENGTH,
++ FFM_CODEC_INFO_EXMARK_MAGIC,
++ FFM_CODEC_INFO_EXMARK_LENGTH);
++
++ channel_layouts = (uint64_t*)(
++ exinfo +
++ FFM_CODEC_INFO_NAME_MAX_LENGTH +
++ FFM_CODEC_INFO_EXMARK_LENGTH
++ );
+
+ info->name = exinfo;
+ info->channel_layouts = channel_layouts;
+
+- for (i = 0; i < count_ch_layouts_in; i++)
+- {
+- if (AV_CHANNEL_ORDER_NATIVE != codec->ch_layouts[i].order) continue;
+- channel_layouts[count_ch_layouts_out++] = codec->ch_layouts[i].u.mask;
++ for (i = 0; i < (unsigned int)count_ch_layouts_in; i++) {
++ if (AV_CHANNEL_ORDER_NATIVE != ch_layouts[i].order)
++ continue;
++
++ channel_layouts[count_ch_layouts_out++] =
++ ch_layouts[i].u.mask;
+ }
++
+ channel_layouts[count_ch_layouts_out] = 0;
+
+ return 0;
+ }
+ #endif
+
+-int __cdecl ffm_audio_get_codec_information(FFM_CodecInfo* info, const char* name, int encode)
++int __cdecl ffm_audio_get_codec_information(
++ FFM_CodecInfo* info,
++ const char* name,
++ int encode)
+ {
+ AVCodec* codec;
++ const int* sample_rates = NULL;
++ const enum AVSampleFormat* sample_fmts = NULL;
++#ifndef FFABI_HAVE_OLD_CHANNEL_LAYOUT
++ const AVChannelLayout* ch_layouts = NULL;
++#endif
++ int num_sample_rates = 0;
++ int num_sample_fmts = 0;
++#ifndef FFABI_HAVE_OLD_CHANNEL_LAYOUT
++ int num_ch_layouts = 0;
++#endif
++ int ret;
+ int i;
+
+ memset(info, 0, sizeof(*info));
+
+ if (encode) {
+- codec = (AVCodec*) avcodec_find_encoder_by_name(name);
++ codec = (AVCodec*)avcodec_find_encoder_by_name(name);
+ } else {
+- codec = (AVCodec*) avcodec_find_decoder_by_name(name);
++ codec = (AVCodec*)avcodec_find_decoder_by_name(name);
+ }
+
+- if (!codec) {
++ if (!codec)
+ return ffmerr(1, encode);
+- }
+
+ info->name = codec->name;
+ info->long_name = codec->long_name;
+- info->sample_rates = codec->supported_samplerates;
++
++ ret = avcodec_get_supported_config(
++ NULL, codec, AV_CODEC_CONFIG_SAMPLE_RATE, 0,
++ (const void**)&sample_rates, &num_sample_rates
++ );
++
++ if (ret < 0)
++ return ffmerr(2, 0);
++
++ info->sample_rates = sample_rates;
++
+ #ifdef FFABI_HAVE_OLD_CHANNEL_LAYOUT
+ info->channel_layouts = codec->channel_layouts;
+ #else
+- if (NULL == codec->ch_layouts) {
++ ret = avcodec_get_supported_config(
++ NULL, codec, AV_CODEC_CONFIG_CHANNEL_LAYOUT, 0,
++ (const void**)&ch_layouts, &num_ch_layouts
++ );
++
++ if (ret < 0)
++ return ffmerr(2, 0);
++
++ if (NULL == ch_layouts) {
+ info->channel_layouts = NULL;
+ } else {
+- if (set_codec_info_extended(info, codec)) {
++ if (set_codec_info_extended(info, codec))
+ return ffmerr(2, 0);
+- }
+ }
+ #endif
++
+ info->id = codec->id;
+ info->capabilities = codec->capabilities;
++
+ if (codec->profiles) {
+- for (i=0;i<32;i++) {
+- if (codec->profiles[i].profile==AV_PROFILE_UNKNOWN)
++ for (i = 0; i < 32; i++) {
++ if (codec->profiles[i].profile == AV_PROFILE_UNKNOWN)
+ break;
+- info->profiles_names[i]=codec->profiles[i].name;
+- info->profiles_values[i]=codec->profiles[i].profile;
+- info->profiles_count = i+1;
++
++ info->profiles_names[i] = codec->profiles[i].name;
++ info->profiles_values[i] = codec->profiles[i].profile;
++ info->profiles_count = i + 1;
+ }
+ }
+- if (codec->sample_fmts) {
+- for (i=0;i<16;i++) {
+- if (codec->sample_fmts[i]==AV_SAMPLE_FMT_NONE)
+- break;
+- info->sample_formats[i]=(uint8_t)back_translate_sample_fmt(codec->sample_fmts[i]);
+- info->sample_formats_count = i+1;
++
++ ret = avcodec_get_supported_config(
++ NULL, codec, AV_CODEC_CONFIG_SAMPLE_FORMAT, 0,
++ (const void**)&sample_fmts, &num_sample_fmts
++ );
++
++ if (ret < 0)
++ return ffmerr(2, 0);
++
++ if (sample_fmts) {
++ for (i = 0; i < num_sample_fmts && i < 16; i++) {
++ info->sample_formats[i] =
++ (uint8_t)back_translate_sample_fmt(sample_fmts[i]);
++ info->sample_formats_count = i + 1;
+ }
+ }
+