mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-08-09 01:21:06 +00:00
avformat/mp3enc: fix underflow of the LAME encoder delay
AV_RL32() is unsigned, so a skip_samples value below 528 + 1 wraps around
instead of clamping to zero and is written out as a delay of 4095 samples.
(cherry picked from commit 146e0f7b79)
Signed-off-by: Romain Beauxis <romain.beauxis@gmail.com>
This commit is contained in:
@@ -367,9 +367,9 @@ static int mp3_write_audio_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
AV_PKT_DATA_SKIP_SAMPLES,
|
||||
&side_data_size);
|
||||
if (side_data && side_data_size >= 10) {
|
||||
mp3->padding = FFMAX(AV_RL32(side_data + 4) + 528 + 1, 0);
|
||||
mp3->padding = FFMAX((int64_t)AV_RL32(side_data + 4) + 528 + 1, 0);
|
||||
if (!mp3->delay)
|
||||
mp3->delay = FFMAX(AV_RL32(side_data) - 528 - 1, 0);
|
||||
mp3->delay = FFMAX((int64_t)AV_RL32(side_data) - 528 - 1, 0);
|
||||
} else {
|
||||
mp3->padding = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user