Advanced Scene Switcher

Advanced Scene Switcher 1.37.2

Crash (0xc0000409) on Start when a window title is very long (512 CJK characters) and a Window condition is used

Hi, thanks for the great plugin!

Describe the bug:
OBS crashes immediately after pressing "Start" in Advanced Scene Switcher when a macro uses the "Window" condition and there is a window open with a very long title containing CJK (Chinese) characters.

In my case a Chrome tab showing a long Threads/X post put the whole post text into the window title. The title was 512 characters long, all Chinese. As soon as I closed that tab, the crash stopped. With the tab open, it crashed every time.

Steps to reproduce:
1. Open a browser tab whose window title is very long (about 512 Chinese characters).
2. Create a macro with a "Window" condition (check title, no regex) and any action (I used "Scene item visibility").
3. Press "Start" on the General tab.
4. OBS closes within a few seconds.

Pausing all macros with the Window condition also stops the crash.

Crash info (Windows Event Viewer):
- Faulting application: obs64.exe 33.0.1.0 (also happened on 32.0.2)
- Faulting module: advanced-scene-switcher-lib.dll
- Exception code: 0xc0000409
- Fault offset: 0x000000000034c801 (same offset every time)

The OBS log ends right after "[adv-ss] started". OBS does not write a crash report.

I am not a developer, but exception 0xc0000409 at the same offset every time makes me suspect a fixed-size buffer that is too small when the window title is converted to UTF-8. Each Chinese character becomes 3 bytes.

Environment:
- Advanced Scene Switcher 1.37.2 (latest)
- OBS 33.0.1 (also 32.0.2)
- Windows 10 Home 22H2 (19045), 64-bit

Thank you!
 
Crash (0xc0000409) on Start when a window title is very long (512 CJK characters) and a Window condition is used

Hi, thanks for the great plugin!

Describe the bug:
OBS crashes immediately after pressing "Start" in Advanced Scene Switcher when a macro uses the "Window" condition and there is a window open with a very long title containing CJK (Chinese) characters.

In my case a Chrome tab showing a long Threads/X post put the whole post text into the window title. The title was 512 characters long, all Chinese. As soon as I closed that tab, the crash stopped. With the tab open, it crashed every time.

Steps to reproduce:
1. Open a browser tab whose window title is very long (about 512 Chinese characters).
2. Create a macro with a "Window" condition (check title, no regex) and any action (I used "Scene item visibility").
3. Press "Start" on the General tab.
4. OBS closes within a few seconds.

Pausing all macros with the Window condition also stops the crash.

Crash info (Windows Event Viewer):
- Faulting application: obs64.exe 33.0.1.0 (also happened on 32.0.2)
- Faulting module: advanced-scene-switcher-lib.dll
- Exception code: 0xc0000409
- Fault offset: 0x000000000034c801 (same offset every time)

The OBS log ends right after "[adv-ss] started". OBS does not write a crash report.

I am not a developer, but exception 0xc0000409 at the same offset every time makes me suspect a fixed-size buffer that is too small when the window title is converted to UTF-8. Each Chinese character becomes 3 bytes.

Environment:
- Advanced Scene Switcher 1.37.2 (latest)
- OBS 33.0.1 (also 32.0.2)
- Windows 10 Home 22H2 (19045), 64-bit

Thank you!
Thanks for reporting the issue!

I think I was able to find the root cause.
In some placed a fixed buffer size of 512 characters was used.

A build with a fix will be available here in a few minutes if you have a GitHub account:

If you don't have a GitHub I will share an alternative link tomorrow.

Update:
Here is the link not requiring to be logged into GitHub:
 
Last edited:
Hi,

I'm using 1.37.2.

I have an unintentional circular referencing Macro.

Somehow ASS replaced the macros I'd selected in some Macro Run macros with the name of the parent macro which of course crashes OBS when the macros are run. The parent is a run once macro so nothing happened until I closed and reopened OBS. I made a screenshot before I closed it and in hindsight I should have fixed it before closing it but in my defense it was at 2:30 AM and I wasn't fully thinking straight.

I have no idea how it happened but even in my foggy state I would not have done something like in the picture where it is obvious that so many macros point back to the parent macro and they already had the correct macro names. I'll try to recreate it but I'm not hopeful.

regards,

David
 

Attachments

  • ASS Circular reference.png
    ASS Circular reference.png
    177.4 KB · Views: 16
Hi,

I'm using 1.37.2.

I've created a projector macro that projects to a TV screen however this screen is often not on when I'm editing a scene collection. This then blanks out the "On" name and it remains blank when I do have the monitor on so I have to remember to re-select it.

regards,

David
 
Hi again,

I'm using 1.37.2.

I'm still on the projector macro area and have found an issue using the window condition testing the existence of a window.

The window condition appears to repeat it’s result with the second time being wrong.
I’m toggling the projection of a source using a macro invoked by a midi control. If the window exists, I close the projector and pause the macro, if the window doesn’t exist, I project the source and pause the macro.

What happens though is with no window showing I unpause once and a window is created, I unpause a second time and the else macros are again invoked and another window is created even though there was already a window. So now with two windows open I unpause a third time and both windows are closed. I unpause a fourth time and and even though there are no windows it still runs the true macros to close a non existent window.
 

Attachments

  • Window Condition.png
    Window Condition.png
    165.6 KB · Views: 10
Hi,

I'm using 1.37.2.

I've created a projector macro that projects to a TV screen however this screen is often not on when I'm editing a scene collection. This then blanks out the "On" name and it remains blank when I do have the monitor on so I have to remember to re-select it.

regards,

David
The plugin should still remember the monitor you have selected, even if that monitor is not connected currently.
It just doesn't show it in the monitor selection, since it is not currently connected.
However, if you explicitly focus - for example by clicking on it - the monitor selection box, a new selection will be made and the previous selection will be lost.

So basically, as long as you don't touch the monitor selection, even plugging in the monitor while the plugin is already running should just work.

But since that is not obvious I will try to make this more clear from a UI perspective and still show the old selection in that case.

Hi again,

I'm using 1.37.2.

I'm still on the projector macro area and have found an issue using the window condition testing the existence of a window.

The window condition appears to repeat it’s result with the second time being wrong.
I’m toggling the projection of a source using a macro invoked by a midi control. If the window exists, I close the projector and pause the macro, if the window doesn’t exist, I project the source and pause the macro.

What happens though is with no window showing I unpause once and a window is created, I unpause a second time and the else macros are again invoked and another window is created even though there was already a window. So now with two windows open I unpause a third time and both windows are closed. I unpause a fourth time and and even though there are no windows it still runs the true macros to close a non existent window.
I think I was able to track down the root cause for this behavior:

The plugin gathers the list of OBS' own windows differently to the ones of regular other applications (for reason I won't get into).
This mechanism runs asynchronously and involves a cache.
I assume the macro in your screenshot is the only place in your macro setup where you check for window titles.
The cache is only refreshed when a new request to get the list of window titles is sent out.
This results in the cache being stale for exactly one iteration before the actual new OBS window list is available.

A build with a fix will be available here in a few minutes on GitHub:

I will share another link which doesn't require you to be logged into GitHub later on.

Update:
 
Last edited:
So basically, as long as you don't touch the monitor selection, even plugging in the monitor while the plugin is already running should just work.

But since that is not obvious I will try to make this more clear from a UI perspective and still show the old selection in that case.
It'd be nice if *every* selection did that: visually kept things that don't presently exist but may again later. I figured it was just a fundamental part of how things worked, and not worth asking about. Just DON'T CHANGE THE RIG while it still has to work. But if the setting *can* be preserved, visually show that, and still work when the thing it's looking for comes back, then I'd call it a great improvement. Still show somehow though, that the thing it's looking for is presently unavailable.
 
Back
Top