Skip to content

fix stack overrun in mz_os_utf8_string_create#890

Merged
nmoinvaz merged 1 commit into
zlib-ng:developfrom
peterh:stacksmash
Jun 16, 2025
Merged

fix stack overrun in mz_os_utf8_string_create#890
nmoinvaz merged 1 commit into
zlib-ng:developfrom
peterh:stacksmash

Conversation

@peterh

@peterh peterh commented Jun 16, 2025

Copy link
Copy Markdown
Contributor

The string_encoding variable goes out of scope right after assignment to from_encoding. Referencing from_encoding after this point is technically a use-after-free error, which leads to arbitrary (undefined) behaviour.

Move string_encoding up to function scope so it survives for as long as it could be referenced.

The string_encoding variable goes out of scope right after assignment to
from_encoding. Referencing from_encoding after this point is technically a
use-after-free error, which leads to arbitrary (undefined) behaviour.

Move string_encoding up to function scope so it survives for as long as it
could be referenced.
@nmoinvaz nmoinvaz merged commit 4f46a3d into zlib-ng:develop Jun 16, 2025
28 checks passed
@Coeur

Coeur commented Jun 17, 2025

Copy link
Copy Markdown
Collaborator

Ah ah!
Thank you peterh. My bad for not seeing this! ;)
#868 (comment)
Capture d’écran 2025-06-17 à 06 55 30

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.

4 participants