hajimehoshi / go-mp3

An MP3 decoder in pure Go
Apache License 2.0
746 stars 80 forks source link

fix: make initialization of nSlen2 safe for concurrent usage #49

Closed alexdor closed 2 years ago

alexdor commented 2 years ago

The concurrent implementation of nSlen2 initialization causes a data race if multiple mp3's are read at the same time and nSlen2 hasn't been already initialized this fixes the race condition by initializing the nSlen2 once