aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vc1acdata.h
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-03-30 03:35:40 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-07-04 19:19:34 +0200
commit5fcc49e0d18a78a668a0f24a9344fab4ce648138 (patch)
tree4d91f4fa7a07db8d8462d4768bc69ab8967c6269 /libavcodec/vc1acdata.h
parent0d2ab226c84f083d12b2d814a7e8b1072a6ae7aa (diff)
downloadffmpeg-5fcc49e0d18a78a668a0f24a9344fab4ce648138.tar.gz
avformat/smacker: Don't increase packet counter prematurely
The Smacker demuxer buffers audio packets before it outputs them, but it increments the counter of buffered packets prematurely: If allocating the audio buffer fails, an error (most likely AVERROR(ENOMEM)) is returned. If the caller decides to call av_read_frame() again, the next call will take the codepath for returning already buffered audio packets and it will fail (because the buffer that ought to be allocated isn't) without decrementing the number of supposedly buffered audio packets (it doesn't matter whether there would be enough memory available in subsequent calls). Depending on the caller's behaviour this is potentially an infinite loop. This commit fixes this by only incrementing the number of buffered audio packets after having successfully read them and unconditionally reducing said number when outputting one of them. It also changes the semantics of the curstream variable: It is now the number of currently buffered audio packets whereas it used to be the index of the last audio stream to be read. (Index refers to the index in the array of buffers, not to the stream index.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/vc1acdata.h')
0 files changed, 0 insertions, 0 deletions