[Live-devel] Access violation crash in rtspclient

Jeff Shanab jshanab at smartwire.com
Sat Nov 19 06:50:43 PST 2011


I know that 99% of the time it is 'adjustments to' and 'missuse' that are the problems people have with using live555, but unless they changed the way CPU's work, we do have an issue.
(This issue is avoided in openRTSP by just exiting the process before the access violation could hit.)

It boils down to calling the destructor of a class from a member in the class puts us in undefined territory.

I call your attention to RTCP.cpp from 11/08/2011

In the switch statement in incomingReportHandler1 at line 511, we handle the case of an incoming "BYE" message.
On line 525 we save the program counter and create a new stack frame to handle the jump long to the bye handler function. As you say and as the openRTSP does Medium::close is called and this calls the DOTR on the very instance we are calling from. On completion of this call the program counter is restored and execution resumes at line 526. The program counter is still valid and so is the CODE segment in memory, only the DATA segment holding the instance was erased in the dtor.
The break on 532 exits the switch taking us to line 542. It passes all test and gets to 583 containing valid stack data and there is nothing to stop it from calling onReceive.
In onReceive, line 593, it tries to access the memory that was returned to the OS during the dtor and an access violation attempting to read that memory is thrown.

For my use case of the live555 libraries, I cannot take the process approach. It would require a re-arching of an existing project and the result would not work well cross platform. I have upto hundreds if not thousands of connected sources and as many, plus another few hundred, sinks.  I have status pages that show status of these streams and notifications on some if they fail. Even then with the dynamic many to many model in this app, I am not sure it would work to have a process for every source with n connections.

From: live-devel-bounces at ns.live555.com [mailto:live-devel-bounces at ns.live555.com] On Behalf Of Ross Finlayson
Sent: Saturday, November 19, 2011 2:11 AM
To: LIVE555 Streaming Media - development & use
Subject: Re: [Live-devel] Access violation crash in rtspclient

The bye handler calls code resulting in Medium::Close. This ends up calling the destructor on the RTCP class and deletes the fKnowMembers.

Yes.



The OnReceive is then attempted to be called

No, that shouldn't be happening, because the "RTCPInstance" destructor called "stopNetworkReading()", which stops any further handling of incoming RTCP packets.

I think you're on a 'wild goose chase' here.  Because the problem in your application seems to be caused by your 'BYE handler' routine, then why don't you tell us what that routine is doing (or trying to do)?

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20111119/7ff970f0/attachment.html>


More information about the live-devel mailing list