mirror of
https://github.com/wader/fq.git
synced 2024-11-28 03:02:55 +03:00
mpeg_spu: Fatal error on infinite loop
This commit is contained in:
parent
6fcfa77300
commit
febce5a5a4
@ -103,6 +103,9 @@ func spuDecode(d *decode.D, in interface{}) interface{} {
|
||||
d.FieldU16("size")
|
||||
dcsqtOffset := d.FieldU16("dcsqt_offset")
|
||||
|
||||
// to catch infinite loops
|
||||
offsetSeen := map[uint64]struct{}{}
|
||||
|
||||
d.SeekAbs(int64(dcsqtOffset) * 8)
|
||||
d.FieldArray("dcsqt", func(d *decode.D) {
|
||||
lastDCSQ := false
|
||||
@ -117,6 +120,11 @@ func spuDecode(d *decode.D, in interface{}) interface{} {
|
||||
return
|
||||
}
|
||||
|
||||
if _, ok := offsetSeen[offset]; ok {
|
||||
d.Fatalf("dcsqt loop detected for %d", offset)
|
||||
}
|
||||
offsetSeen[offset] = struct{}{}
|
||||
|
||||
var pxdTFOffset int64
|
||||
var pxdBFOffset int64
|
||||
var width uint64
|
||||
|
Loading…
Reference in New Issue
Block a user