diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-02-16 09:27:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-16 09:27:42 +0100 |
commit | c1dc38679fff37ed5b9fba820095a18e1487406b (patch) | |
tree | 3a8e8fe713ae6e41117d62a4d5f6f1bc93769d5f /modules/minimp3 | |
parent | f14008b600ff091a07d9dcb53780e9374f36d47f (diff) | |
parent | 936767deca7d9d5f771e174d2ced866877e5d2af (diff) |
Merge pull request #46039 from ellenhp/fix-empty-mp3-crash
Warn and return when attempting to load invalid MP3s
Diffstat (limited to 'modules/minimp3')
-rw-r--r-- | modules/minimp3/audio_stream_mp3.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/minimp3/audio_stream_mp3.cpp b/modules/minimp3/audio_stream_mp3.cpp index 8627f71987..b128b81000 100644 --- a/modules/minimp3/audio_stream_mp3.cpp +++ b/modules/minimp3/audio_stream_mp3.cpp @@ -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; |