diff mbox series

[FFmpeg-devel] avcodec/ac3_tab: Zero-terminate ff_ac3_sample_rate_tab

Message ID 20200411141823.9403-1-andreas.rheinhardt@gmail.com
State Accepted
Commit 12a5e0409d32105b7ae3346cf2cdf83b40ab33b2
Headers show
Series [FFmpeg-devel] avcodec/ac3_tab: Zero-terminate ff_ac3_sample_rate_tab | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt April 11, 2020, 2:18 p.m. UTC
This is required to use it as an AVCodec.supported_samplerates array.
Adding the sentinel has been forgotten in 4679a474.
Without it e.g. the FATE-test ffmpeg-filter_complex_audio fails with ASAN.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/ac3tab.c | 2 +-
 libavcodec/ac3tab.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Carl Eugen Hoyos April 11, 2020, 2:46 p.m. UTC | #1
Am Sa., 11. Apr. 2020 um 16:41 Uhr schrieb Andreas Rheinhardt
<andreas.rheinhardt@gmail.com>:
>
> This is required to use it as an AVCodec.supported_samplerates array.
> Adding the sentinel has been forgotten in 4679a474.
> Without it e.g. the FATE-test ffmpeg-filter_complex_audio fails with ASAN.

lgtm

Thank you, Carl Eugen
Andreas Rheinhardt April 11, 2020, 3:18 p.m. UTC | #2
Carl Eugen Hoyos:
> Am Sa., 11. Apr. 2020 um 16:41 Uhr schrieb Andreas Rheinhardt
> <andreas.rheinhardt@gmail.com>:
>>
>> This is required to use it as an AVCodec.supported_samplerates array.
>> Adding the sentinel has been forgotten in 4679a474.
>> Without it e.g. the FATE-test ffmpeg-filter_complex_audio fails with ASAN.
> 
> lgtm
> 
> Thank you, Carl Eugen

Applied, thanks.

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/ac3tab.c b/libavcodec/ac3tab.c
index 96ef8ebaeb..ef2a41bc59 100644
--- a/libavcodec/ac3tab.c
+++ b/libavcodec/ac3tab.c
@@ -126,7 +126,7 @@  const uint8_t ff_ac3_dec_channel_map[8][2][6] = {
 };
 
 /* possible frequencies */
-const int ff_ac3_sample_rate_tab[3] = { 48000, 44100, 32000 };
+const int ff_ac3_sample_rate_tab[] = { 48000, 44100, 32000, 0 };
 
 /* possible bitrates */
 const uint16_t ff_ac3_bitrate_tab[19] = {
diff --git a/libavcodec/ac3tab.h b/libavcodec/ac3tab.h
index f0f6e6ccc4..1d1264e3fc 100644
--- a/libavcodec/ac3tab.h
+++ b/libavcodec/ac3tab.h
@@ -33,7 +33,7 @@  extern const uint8_t  ff_ac3_channels_tab[8];
 extern av_export_avcodec const uint16_t avpriv_ac3_channel_layout_tab[8];
 extern const uint8_t  ff_ac3_enc_channel_map[8][2][6];
 extern const uint8_t  ff_ac3_dec_channel_map[8][2][6];
-extern const int      ff_ac3_sample_rate_tab[3];
+extern const int      ff_ac3_sample_rate_tab[];
 extern const uint16_t ff_ac3_bitrate_tab[19];
 extern const uint8_t  ff_ac3_rematrix_band_tab[5];
 extern const uint8_t  ff_eac3_default_cpl_band_struct[18];