History

mov: stsd entries must be at least 16 byte

Fix near infinite loop in stsd parsing. Bug found by: Diana Elena Muscalu The size is unsigned according the specification.

Michael Niedermayer committed 14 years ago

Commit a5ea6231 parent 9db67be1 file · +4 −1Browse files

Unified · Split

libavformat/mov.c+4−1
@@ -1098,13 +1098,16 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) · 1097 unmodified lines
10981098 int dref_id = 1;
10991099 MOVAtom a = { AV_RL32("stsd") };
11001100 int64_t start_pos = avio_tell(pb);
1101− int size = avio_rb32(pb); /* size */
1101+ uint32_t size = avio_rb32(pb); /* size */
11021102 uint32_t format = avio_rl32(pb); /* data format */
11031103
11041104 if (size >= 16) {
11051105 avio_rb32(pb); /* reserved */
11061106 avio_rb16(pb); /* reserved */
11071107 dref_id = avio_rb16(pb);
1108+ } else {
1109+ av_log(c->fc, AV_LOG_ERROR, "invalid size %d in stsd\n", size);
1110+ return AVERROR_INVALIDDATA;
11081111 }
11091112
11101113 if (st->codec->codec_tag &&

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