Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ambed openstream timeout issue #222

Merged
merged 1 commit into from
Mar 1, 2023
Merged

fix ambed openstream timeout issue #222

merged 1 commit into from
Mar 1, 2023

Conversation

narspt
Copy link
Contributor

@narspt narspt commented Aug 19, 2022

This patch fixes an old bug on xlxd related with ambed openstream timeout, actually if the openstream response packet from ambed to xlxd is completely lost then no problem happens at all, however if timeout is reached but xlxd still gets the packet after timeout then transcoding gets fully broken with crashing streams forever until xlxd is restarted.

The problem is discussed at issues #115 , #141 and probably also #168 , the workaround of @lucamarche-iz1mlt is to tweak this timeout (and inherently some other timeouts) to an high value to avoid it but the bug is still there... also it should be easy for a malicious user to take advantage of this to break any XLX, as easy as simulate an openstream response packet...

The problem happens because when xlxd gets openstream response packet it will always call m_SemaphoreOpenStream.Notify(), thus incrementing semaphore m_Count that will never be decremented because WaitFor() already timedout... and... this incremented m_Count will cause all subsequent WaitFor() calls to return immediately, before getting the required stream details... My solution is maybe not the most elegant code but it fixes the problem, I didn't use just Reset() as it could eventually discard concurrent notifies...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants