Crash: access violation in WM_SETTINGCHANGE with lParam == 0 #19189

Closed
opened 2026-01-31 06:36:19 +00:00 by claunia · 1 comment
Owner

Originally created by @jboelter on GitHub (Jan 8, 2023).

Windows Terminal version

developer build

Windows build number

10.0.22621.963

Other Software

N/A

Steps to reproduce

Using the "Switch User" feature of Windows and ran into an issue with a WM_SETTINGCHANGE getting fired at IslandWindow.cpp with wParam == 0 and lParam == 0. This in turn crashes while constructing the string on this line:

const std::wstring param{ (wchar_t*)lparam };

21a62c5fef/src/cascadia/WindowsTerminal/IslandWindow.cpp (L661-L677)

The docs also suggest that NULL is a valid parameter for lParam.

https://learn.microsoft.com/en-us/windows/win32/winmsg/wm-settingchange

lParam

When the system sends this message as a result of a SystemParametersInfo call, lParam is a pointer to a string that indicates the area containing the system parameter that was changed. This parameter does not usually indicate which specific system parameter changed. (Note that some applications send this message with lParam set to NULL.) In general, when you receive this message, you should check and reload any system parameter settings that are used by your application.

Expected Behavior

No crash.

Actual Behavior

crash due to access violation (nullptr)

Originally created by @jboelter on GitHub (Jan 8, 2023). ### Windows Terminal version developer build ### Windows build number 10.0.22621.963 ### Other Software N/A ### Steps to reproduce Using the "Switch User" feature of Windows and ran into an issue with a `WM_SETTINGCHANGE` getting fired at `IslandWindow.cpp` with `wParam == 0` and `lParam == 0`. This in turn crashes while constructing the string on this line: ```cpp const std::wstring param{ (wchar_t*)lparam }; ``` https://github.com/microsoft/terminal/blob/21a62c5fefa36c619bd15bc80d43f54b4d878a5d/src/cascadia/WindowsTerminal/IslandWindow.cpp#L661-L677 The docs also suggest that NULL is a valid parameter for lParam. https://learn.microsoft.com/en-us/windows/win32/winmsg/wm-settingchange > lParam > > When the system sends this message as a result of a [SystemParametersInfo](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-systemparametersinfoa) call, lParam is a pointer to a string that indicates the area containing the system parameter that was changed. This parameter does not usually indicate which specific system parameter changed. (Note that some applications send this message with lParam set to NULL.) In general, when you receive this message, you should check and reload any system parameter settings that are used by your application. ### Expected Behavior No crash. ### Actual Behavior crash due to access violation (nullptr)
claunia added the Resolution-Fix-CommittedIssue-BugProduct-TerminalArea-Windowing labels 2026-01-31 06:36:19 +00:00
Author
Owner

@ghost commented on GitHub (Jan 24, 2023):

:tada:This issue was addressed in #14653, which has now been successfully released as Windows Terminal Preview v1.17.1023.🎉

Handy links:

@ghost commented on GitHub (Jan 24, 2023): :tada:This issue was addressed in #14653, which has now been successfully released as `Windows Terminal Preview v1.17.1023`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.17.1023) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19189