[Live-devel] Invalid timestamp generation in GroupsockHelper (with patch)

Deanna Earley dee.earley at icode.co.uk
Fri Oct 3 01:53:34 PDT 2014


Hello all.

While investigating a crash when a camera sent multicast details in the SDP, I tracked down the problem to timestampString in GroupsockHelper which turned out to be an Invalid argument exception being raised inside ctime (actually _tctime64, calling _localtime64_s).

When using Windows SDK 7.1, time_t is defined as a 64 bit value by default (__time64_t) and due to an invalid cast resulted in a massively out of range value.

char const* ctimeResult = ctime((time_t*)&tvNow.tv_sec);

The 32-bit seconds value (followed by the 32-bit microseconds value) is cast to a single 64-bit seconds value giving a unix time of 2816954497596031 instead of a far more reasonable 1412266623.

Doing an implicit cast/assignment to a real time_t value and passing a pointer to that, resolves the crash.

time_t tvNow_t = tvNow.tv_sec;
char const* ctimeResult = ctime(&tvNow_t);

Would you consider including the attached patch in the next release of liveMedia?

Many thanks.

-- 
Deanna Earley | Lead developer | icatchercctv

w: www.icode.co.uk/icatcher | t: 01329 835335 | f: 01329 835338
Registered Office : 71 The Hundred, Romsey, SO51 8BZ. Company Number : 03428325

-------------- next part --------------
A non-text attachment was scrubbed...
Name: liveMedia GroupsockHelper timestampString invalidcast.patch
Type: application/octet-stream
Size: 533 bytes
Desc: liveMedia GroupsockHelper timestampString invalidcast.patch
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20141003/988bd4ae/attachment.obj>


More information about the live-devel mailing list