Skip to content

fix: replace unsafe memset with initializer list in BitStream ctor #137

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

moleium
Copy link

@moleium moleium commented Apr 18, 2025

This PR replaces the potentially unsafe memset(this, 0, offsetof(BitStream, allocator)) call within the BitStream(IMemAlloc *a) default constructor with a standard C++ member initializer list.

Original memset approach is fragile and could lead to memory corruption if the class layout or padding changes in the future, zeroing out the allocator member itself before assignment.

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.

1 participant