[ previous ] [ next ] [ threads ]
 To :  yate@v...
 From :  Allan Sandfeld Jensen <linux@c...>
 Subject :  Re: [yate] Memory corruption in extmodule.yate
 Date :  Mon, 14 Jun 2010 14:43:51 +0200
On Monday 14 June 2010, Alexander Kovalenko wrote:
> Result: application will crash and Application Verifier will report
> "First chance access violation for current stack trace" error. This
> problem exists either in Yate-2.2.0-1 or in Yate-3.0.0-alpha3.
> When port extmodule listens to is opened, ExtModReceiver::start() is
> called. ExtModReceiver::start() runs new ExtThread. When ExtThread is
> finished it deletes instance of ExtModReceiver. If port is closed very
> fast this ExtThread may delete ExtModReceiver before
> ExtModReceiver::start() will be finished. In this case
> ExtModReceiver::start() tries to access memory which has been already
> deleted.

When the thread finishes it calls unuse() on the extmodreceiver. 
ExtModReceiver::build takes an argument called 'ref' to protect against 
deletion before build is finished, by calling use() before start(). Are you 
sure it is not somewhere else it goes wrong?

I know of a problem when the ExtModChan closes before ExtThread::clenup have 
been run, but it sounds different.

Regards
Allan