1
1
mirror of https://github.com/wader/fq.git synced 2024-12-23 13:22:58 +03:00

mp4,fuzz: Fatal error on infinite sgpd box entries

Also rename array to entries
This commit is contained in:
Mattias Wadman 2022-01-23 14:11:55 +01:00
parent 21ce6574fa
commit d555c3248c
3 changed files with 11 additions and 7 deletions

View File

@ -1070,15 +1070,19 @@ func init() {
d.FieldU32("default_sample_description_index")
}
entryCount := d.FieldU32("entry_count")
d.FieldArray("groups", func(d *decode.D) {
d.FieldArray("entries", func(d *decode.D) {
for i := uint64(0); i < entryCount; i++ {
entryLen := defaultLength
if version == 1 {
if defaultLength == 0 {
entryLen = d.FieldU32("descriptor_length")
entryLen = d.FieldU32("description_length")
} else if entryLen == 0 {
d.Fatalf("sgpd groups entry len <= 0 version 1")
}
} else if entryLen == 0 {
d.Fatalf("sgpd groups entry len <= 0")
}
d.FieldRawLen("group", int64(entryLen)*8)
d.FieldRawLen("data", int64(entryLen)*8)
}
})
},

View File

@ -302,8 +302,8 @@ $ fq -d mp4 verbose /aac.mp4
0x510| 72 6f 6c 6c | roll | grouping_type: 1919904876 0x511-0x514.7 (4)
0x510| 00 00 00 02 | .... | default_length: 2 0x515-0x518.7 (4)
0x510| 00 00 00 01 | .... | entry_count: 1 0x519-0x51c.7 (4)
| | | groups[0:1]: 0x51d-0x51e.7 (2)
0x510| ff ff | .. | [0]: raw bits group 0x51d-0x51e.7 (2)
| | | entries[0:1]: 0x51d-0x51e.7 (2)
0x510| ff ff | .. | [0]: raw bits data 0x51d-0x51e.7 (2)
| | | [6]{}: box 0x51f-0x53a.7 (28)
0x510| 00| .| size: 28 0x51f-0x522.7 (4)
0x520|00 00 1c |... |

View File

@ -294,8 +294,8 @@ $ fq -d mp4 verbose /dash_audio_init.mp4
0x2b0| 00 00 00 02 | .... | default_length: 2 0x2ba-0x2bd.7 (4)
0x2b0| 00 00| ..| entry_count: 1 0x2be-0x2c1.7 (4)
0x2c0|00 01 |.. |
| | | groups[0:1]: 0x2c2-0x2c3.7 (2)
0x2c0| ff ff | .. | [0]: raw bits group 0x2c2-0x2c3.7 (2)
| | | entries[0:1]: 0x2c2-0x2c3.7 (2)
0x2c0| ff ff | .. | [0]: raw bits data 0x2c2-0x2c3.7 (2)
| | | [2]{}: box 0x2c4-0x2d3.7 (16)
0x2c0| 00 00 00 10 | .... | size: 16 0x2c4-0x2c7.7 (4)
0x2c0| 73 6d 68 64 | smhd | type: "smhd" (Sound media header, overall information (sound track only)) 0x2c8-0x2cb.7 (4)