1
1
mirror of https://github.com/wader/fq.git synced 2024-11-24 11:16:09 +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:
Mattias Wadman 2022-01-24 17:53:56 +01:00 committed by GitHub
commit 4f490e5618
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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