[vlc-commits] [Git][videolan/vlc][3.0.x] qt: fix NULL-pointer write on posted WM_APPCOMMAND
Steve Lhomme (@robUx4)
gitlab at videolan.org
Wed Oct 28 11:17:05 UTC 2026
Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC
Commits:
78786d08 by Karel Polak at 2026-10-28T11:11:12+00:00
qt: fix NULL-pointer write on posted WM_APPCOMMAND
nativeEventFilter() dereferenced result unconditionally in the
WM_APPCOMMAND case. Qt does not guarantee that result is non-NULL:
QEventDispatcherWin32::processEvents() invokes native event filters with
result == 0 for messages taken off the thread message queue, whereas
qt_internal_proc() passes a valid pointer.
Any application delivering WM_APPCOMMAND with PostMessage() instead of
SendMessage() therefore caused a write to address 0x0. Reproduced 6/6 on
3.0.23 (win32 and win64) and 5/5 on 4.0.0-dev; the identical message
delivered with SendMessage pauses correctly.
Keep the handled state in a local and only write through result when it
is non-NULL, since the trailing check read *result as well.
Fixes #30070
(cherry picked from commit b385ae43047e06164ed1afc59ce705f2efe38786) (edited)
edited:
- in VLC 3 the code is still in main_interface_win32.cpp
Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
- - - - -
1 changed file:
- modules/gui/qt/main_interface_win32.cpp
Changes:
=====================================
modules/gui/qt/main_interface_win32.cpp
=====================================
@@ -231,6 +231,7 @@ bool MainInterfaceWin32::nativeEventFilter(const QByteArray &, void *message, lo
}
short cmd;
+ bool handled = false;
switch( msg->message )
{
case WM_COMMAND:
@@ -262,7 +263,7 @@ bool MainInterfaceWin32::nativeEventFilter(const QByteArray &, void *message, lo
break;
}
- *result = TRUE;
+ handled = TRUE;
switch(cmd)
{
@@ -312,10 +313,13 @@ bool MainInterfaceWin32::nativeEventFilter(const QByteArray &, void *message, lo
break;
default:
msg_Dbg( p_intf, "unknown APPCOMMAND = %d", cmd);
- *result = FALSE;
+ handled = false;
break;
}
- if (*result) return true;
+ if( result )
+ *result = handled ? TRUE : FALSE;
+ if( handled )
+ return true;
break;
}
return false;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/78786d082504304ce84d56c88ce6e7ef4354c887
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/78786d082504304ce84d56c88ce6e7ef4354c887
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list