Skip to content

Undefined behaviour in vsnprintf_wrapper #4

@EliteTK

Description

@EliteTK

Currently vsnprintf_wrapper invokes va_copy but does not invoke va_end before return.

N3220§7.16.1p1

... Each invocation of the va_start and va_copy macros shall be matched by a corresponding invocation of the va_end macro in the same function.

"shall" actually means it's undefined behaviour not to do it, but there is a more explicit statement too:

N3220§7.16.1.3p2

... If there is no corresponding invocation of the va_start or va_copy macro, or if the va_end macro is not invoked before the return, the behavior is undefined.

This is the same wording as in C99 when va_copy was added.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions