Skip to content

Prevent undefined behavior in Windows vasprintf#2630

Open
metsw24-max wants to merge 1 commit into
facebook:mainfrom
metsw24-max:vasprintf-va-list-handling-windows
Open

Prevent undefined behavior in Windows vasprintf#2630
metsw24-max wants to merge 1 commit into
facebook:mainfrom
metsw24-max:vasprintf-va-list-handling-windows

Conversation

@metsw24-max

Copy link
Copy Markdown
Contributor

The Windows vasprintf implementation reused a consumed va_list across two vsnprintf calls, which is invalid and can produce incorrect output or crashes. Use va_copy for each call to ensure correct behavior.

Also avoid assigning to *dest before success to prevent returning a pointer on failure.

@meta-cla meta-cla Bot added the CLA Signed label Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

1 participant