[Live-devel] Segfault in Linux / References to Null objects

Marco Porsch Marco.Porsch at intenta.de
Wed Jan 24 03:04:18 PST 2018


Hi,

I encounter segfaults in LIVE555 Streaming Media on stream start after building with Debian's gcc 6.3.0-18.

The issue occurs in RTSPCommon.cpp: parseRangeParam(...):
  delete[] absStartTime; delete[] absEndTime;

Trouble is that both to-be-deleted variables are invalid. When tracing back, I see RTSPClient.cpp: handlePLAYResponse(...) being called with an argument
  MediaSession& session
pointing to Null. This is expected to be caught in the following line
  if (&session != NULL) {
but GDB shows the program skipping into the true-branch right after this check.

The reason for this behavior is that in C++ a reference is expected to be initialized on a valid object only. So gcc's optimizer removes the always-true conditional leading to the mentioned segfault.

I found the following patch by Hugo Beauzée-Luyssen in the videolan repo that fixes this bug for me. It applies to the most recent source code packet "live.2017.10.28.tar.gz".
http://git.videolan.org/gitweb.cgi/vlc.git/?p=vlc.git;a=blob_plain;f=contrib/src/live555/no-null-reference.patch;h=a1dea30fbc5e7b13e3616c190f9b626e97d2e156;hb=HEAD
Source is here.
http://git.videolan.org/gitweb.cgi/vlc.git/?p=vlc.git;a=tree;f=contrib/src/live555

Best Regards,
--Marco Porsch




More information about the live-devel mailing list