[PyQt] Crash when reading negative size of data from QUdpSocket

İsmail Dönmez ismail at namtrac.org
Tue Jun 24 17:16:47 BST 2008


Using latest sip/PyQt snapshots with Qt4.4, see following:

>>> from PyQt4.QtNetwork import QHostAddress, QUdpSocket
>>> socket = QUdpSocket()
>>> success = socket.bind(QHostAddress(""), 5555)
>>> success
>>> socket.readData(-1)
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

Simply returning None when a negative size is given is a better idea.


Never learn by your mistakes, if you do you may never dare to try again.

More information about the PyQt mailing list