happycube / ld-decode

Software defined LaserDisc decoder
GNU General Public License v3.0
296 stars 76 forks source link

Add a sanity check for EFM section timestamps #843

Closed atsampson closed 1 year ago

atsampson commented 1 year ago

The section CRC is only 16 bits, so there's a 1/65536 chance of invalid Q data making it through. If the section timestamp is corrupted, ld-process-efm can end up trying to insert an absurd amount of padding, and eating gigabytes of memory as a result.

Check that a timestamp isn't more than 100 minutes after the start of the disc. CDs can be longer than LaserDisc sides, but they seem to top out at about 90 minutes in practice (e.g. side 2 of "Bäst Of" by Die Ärtze).

The logic here is a bit subtle, so this is one for Simon to look at...