Skip to content

Commit 9100466

Browse files
committed
Fixed a possible access violation in WApplication::UpdateLock
1 parent 3aa6804 commit 9100466

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Wt/WApplication.C

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1470,6 +1470,14 @@ WApplication::UpdateLock::UpdateLock(WApplication *app)
14701470
#ifndef WT_THREADED
14711471
return;
14721472
#else
1473+
1474+
// check if 'app' is a nullptr to prevent an access violation
1475+
// in the following code
1476+
if (!app) {
1477+
ok_ = false;
1478+
return;
1479+
}
1480+
14731481
/*
14741482
* If we are already handling this application, then we already have
14751483
* exclusive access, unless we are not having the lock (e.g. from a
@@ -1498,8 +1506,12 @@ WApplication::UpdateLock::UpdateLock(WApplication *app)
14981506
WebSession::Handler *handler = WebSession::Handler::instance();
14991507

15001508
createdHandler_ = false;
1501-
if (handler && handler->haveLock() && handler->session() == app->session_)
1509+
if (!app) {
1510+
return;
1511+
}
1512+
if (handler && handler->haveLock() && handler->session() == app->session_) {
15021513
return;
1514+
}
15031515

15041516
new WebSession::Handler(app->session_, WebSession::Handler::LockOption::TakeLock);
15051517

0 commit comments

Comments
 (0)