roman380/gdcl.co.uk-mpeg4

Error in mp4demux/Index.cpp with large files with fixed frame time

ReggThims opened this issue · 0 comments

In Index.cpp line 301 in SampleTimes::Parse(), the expression on the rhs can overflow:

	m_total = 0;
	for (int i = 0; i < m_nSTTS; i++)
	{
		long nEntries = SwapLong(m_pSTTS + 8 + (i * 8));
		long nDuration = SwapLong(m_pSTTS + 8 + 4 + (i * 8));
		m_total += (nEntries * nDuration);	// <- this can overflow
	}
	m_total = TrackToReftime(m_total);

A simple solution is to make nEntries a LONGLONG.
I have a user who hit this problem with a file with all frames at the same interval at 42000(!) seconds into replay from which I deduce that the file has a movie scale of 100000.