avformat/mov: Error on too large stsd entry counts.
Entries are always at least 8 bytes per the parsing code, so if we
see an impossible entry count avoid massive allocations. This is
similar to an existing check in mov_read_stsc().
Since ff_mov_read_stsd_entries() does eof checks, an alternative
approach could be to clamp the entry count to atom.size / 8.
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 320b631a99)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
84ab680624
commit
968ffb93af
1 changed files with 2 additions and 1 deletions
|
|
@ -2554,7 +2554,8 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
|||
avio_rb24(pb); /* flags */
|
||||
entries = avio_rb32(pb);
|
||||
|
||||
if (entries <= 0) {
|
||||
/* Each entry contains a size (4 bytes) and format (4 bytes). */
|
||||
if (entries <= 0 || entries > atom.size / 8) {
|
||||
av_log(c->fc, AV_LOG_ERROR, "invalid STSD entries %d\n", entries);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue