History

avformat/mp3dec: Count last partial frame in probe.

Fixes: regression Fixes: Ticket8511

Michael Niedermayer committed 6 years ago

Commit 23645f91 parent dfa1fc11 file · +9 −3Browse files

Unified · Split

libavformat/mp3dec.c+9−3
@@ -87,20 +87,26 @@ static int mp3_read_probe(const AVProbeData *p) · 86 unmodified lines
8787 for (framesizes = frames = 0; buf2 < end; frames++) {
8888 MPADecodeHeader h;
8989 int header_emu = 0;
90+ int available;
9091
9192 header = AV_RB32(buf2);
9293 ret = avpriv_mpegaudio_decode_header(&h, header);
93− if (ret != 0 || end - buf2 < h.frame_size)
94+ if (ret != 0)
9495 break;
9596
96− for (buf3 = buf2 + 4; buf3 < buf2 + h.frame_size; buf3++) {
97+ available = FFMIN(h.frame_size, end - buf2);
98+ for (buf3 = buf2 + 4; buf3 < buf2 + available; buf3++) {
9799 uint32_t next_sync = AV_RB32(buf3);
98100 header_emu += (next_sync & MP3_MASK) == (header & MP3_MASK);
99101 }
100102 if (header_emu > 2)
101103 break;
102− buf2 += h.frame_size;
103104 framesizes += h.frame_size;
105+ if (available < h.frame_size) {
106+ frames++;
107+ break;
108+ }
109+ buf2 += h.frame_size;
104110 }
105111 max_frames = FFMAX(max_frames, frames);
106112 max_framesizes = FFMAX(max_framesizes, framesizes);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t