[PyQt] segfault / infinite loop in sip's parser

Phil Thompson phil at riverbankcomputing.com
Thu Jun 12 22:14:13 BST 2008


On Wednesday 04 June 2008 12:15:05 am Erick Tryzelaar wrote:
> Hello again,
>
> I'm still trying to track down the other segfaults, but in the process
> I found one in sip's grammar. I found that if I edited pyqt4's
> sip/phonon/phononmod.sip to be:
>
>
> %Module PyQt4.phonon 0
> %Import QtCore/QtCoremod.sip
> %Import QtGui/QtGuimod.sip
>
>
> And then had sip/QWebKit/QWebKitmod.sip to be:
>
>
> %Module PyQt4.QtWebKit 0
> %Import QtCore/QtCoremod.sip
> %Import QtGui/QtGuimod.sip
> %Import QtNetwork/QtNetworkmod.sip
>
>
> It will segfault with an infinite loop as sip manages the imports. I
> believe this is happening because the parser isn't calling
> "handleEOM". It looks like there needs to be at least one non-import
> token after an import for it to get called. If we add this:
>
> %Module PyQt4.phonon 0
> %Import QtCore/QtCoremod.sip
> %Import QtGui/QtGuimod.sip
> %Copying
>
> %End
>
> It won't segfault anymore.

This is actually difficult to fix and really needs a SIP language change to do 
properly. As it's the first time its been reported and the code is nearly 10 
years old it's not high on the TODO list.

Phil


More information about the PyQt mailing list