anthwlock / untrunc

Restore a truncated mp4/mov. Improved version of ponchio/untrunc
GNU General Public License v2.0
1.9k stars 182 forks source link

Fix a possible division by zero in HasHeaderAtom::getDurationInMs() #34

Closed jleclanche closed 4 years ago

jleclanche commented 4 years ago

Fixes #8

anthwlock commented 4 years ago

fixed in dd6537fe

jleclanche commented 4 years ago

I still think not guarding against timescale being zero is a bad idea but thank you for fixing it and thanks again for the tool, you saved me :)

anthwlock commented 4 years ago

One could add an assert(timescale_ > 0) at the end of HasHeaderAtom::readHeaderAtom.

But I really doubt you will find this in any healthy file, which timescale_ is read from. With a timescale of 0, you can't translate timestamps to frames.

I just tested it, and vlc player shows for a (with correct timescale) 20s video a duration of 5h 18min, and is unable to show anything but the first frame. mpv won't even start, just spits out error messages on the console.