mirror of
https://github.com/wader/fq.git
synced 2024-11-24 03:05:22 +03:00
Merge pull request #99 from wader/mpeg-spu-fatal-infinit-loop
mpeg_spu: Fatal error on infinite loop
This commit is contained in:
commit
4f490e5618
@ -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