summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2011-04-20 16:21:36 +0100
committerOlivier Goffart <olivier.goffart@nokia.com>2011-05-11 16:37:58 +0200
commit7ee981a834c8b0b8eddf600965a446c5bb124a91 (patch)
treed2c55f576e4421f7d7f50971a3366e84ca83ae13 /src/corelib
parentfe5613123685cf3db61484f5a43cfae3154d5f6f (diff)
Fix crash when QSocketNotifier used with an invalid descriptor
select code for open C file/socket descriptors was crashing in FD_SET if a QSocketNotifier was created with an invalid descriptor. Added two autotests to QSocketNotifier, one to check notifiers with bogus socket descriptors don't crash, the other to check that notifiers with posix socket descriptors do work. (symbian socket engine doesn't use them so they are not implicitly tested) Reviewed-by: mread Task-Number: QTBUG-18138 (cherry picked from commit 8a9a6afcf02f089f932bc81431ab46a60af32134)
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp
index e0eeb0819a..bd12726508 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian.cpp
+++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp
@@ -1111,6 +1111,12 @@ bool QEventDispatcherSymbian::hasPendingEvents()
void QEventDispatcherSymbian::registerSocketNotifier ( QSocketNotifier * notifier )
{
+ //check socket descriptor is usable
+ if (notifier->socket() >= FD_SETSIZE || notifier->socket() < 0) {
+ //same warning message as the unix event dispatcher for easy testing
+ qWarning("QSocketNotifier: Internal error");
+ return;
+ }
//note - this is only for "open C" file descriptors
//for native sockets, an active object in the symbian socket engine handles this
QSocketActiveObject *socketAO = new QSocketActiveObject(this, notifier);