Merge pull request #46039 from ellenhp/fix-empty-mp3-crash

Warn and return when attempting to load invalid MP3s
This commit is contained in:
Rémi Verschelde 2021-02-16 09:27:42 +01:00 committed by GitHub
commit c1dc38679f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -159,7 +159,8 @@ void AudioStreamMP3::set_data(const Vector<uint8_t> &p_data) {
const uint8_t *src_datar = p_data.ptr();
mp3dec_ex_t mp3d;
mp3dec_ex_open_buf(&mp3d, src_datar, src_data_len, MP3D_SEEK_TO_SAMPLE);
int err = mp3dec_ex_open_buf(&mp3d, src_datar, src_data_len, MP3D_SEEK_TO_SAMPLE);
ERR_FAIL_COND(err != 0);
channels = mp3d.info.channels;
sample_rate = mp3d.info.hz;