[Interest] Crash in QAbstractEventDispatcher::filterNativeEvent when trying to show a QMessageBox

Thiago Macieira thiago.macieira at intel.com
Fri Apr 15 00:12:26 CEST 2022


On Thursday, 14 April 2022 14:52:42 PDT Henry Skoglund wrote:
> Indeed it looks weird (it's pointing into 2TB territory) but I believe
> it's just an effect of Microsoft's Control Flow Guard (tm) being active
> for that .exe.

It's possible. I've read about that Windows feature, but have not yet 
experimented with it.

Anyway, the absolute value of a pointer is completely irrelevant and could be 
anything. On Linux, for example, they start from both the top and bottom:

$ gdb -batch -ex start libexec/moc | grep main     
Temporary breakpoint 1 at 0x429415: file /home/tjmaciei/src/qt/qt6/qtbase/src/
tools/moc/main.cpp, line 679.
Temporary breakpoint 1, main (_argc=1, _argv=0x7fffffffd548) at /home/
tjmaciei/src/qt/qt6/qtbase/src/tools/moc/main.cpp:679

That pointer value of 0x7fffffffd548 is near 2^47, which is 128 TB. Meanwhile, 
the address of main is just above 4 MB.

There's also a case of "starting from the middle" for position-independent 
executables:

$ gdb -batch -ex start -ex 'p &main' /bin/ls | tail -1
$1 = (int (*)(int, char **)) 0x555555558700 <main>

I don't know why they chose that bit pattern.

On macOS, all 64-bit pointers are above 4 GB, to aid in catching accidental 
assignments to 32-bit integer variables.

$ lldb --batch --one-line 'p &main' libexec/moc | tail -1
(int (*)(int, char **)) $0 = 0x00000001000301c0

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel DPG Cloud Engineering





More information about the Interest mailing list