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 potential infinite loop in mix_source_buffer() in case of uneven input buffer #31

Merged
merged 1 commit into from
Jan 11, 2025

Conversation

ivan-mogilko
Copy link
Contributor

@ivan-mogilko ivan-mogilko commented Jan 11, 2025

Fix #23

This is a hotfix that we've been using in our game engine for a while now, it covers a rare situation with badly formed input buffer, which I've described in the issue #23.

This fixes a potential infinite loop, which may occur in two cases:

  1. If remaining data in the input is less than bufferframesize, in such case bytesput resulted in 0, and src->offset never advanced.
  2. If remaining data's size is not evenly divided by sizeof(float), the data pointer again will not advance to the end.

This fixes a potential infinite loop, which may occur in two cases:
1. If remaining data in the input is less than `bufferframesize`, in such case `bytesput` resulted in 0, and src->offset never advanced.
2. If remaining data's size is not evenly divided by sizeof(float), the data pointer again will not advance to the end.
@ivan-mogilko ivan-mogilko force-pushed the fix--mixerinfiniteloop branch from 51aa56c to afb81c3 Compare January 11, 2025 15:09
@icculus icculus merged commit aeaeff2 into icculus:main Jan 11, 2025
3 checks passed
@ivan-mogilko ivan-mogilko deleted the fix--mixerinfiniteloop branch January 11, 2025 23:42
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.

Potential infinite loop in sound mixer
2 participants