boostorg / serialization

Boost.org serialization module
http://boost.org/libs/serialization
120 stars 139 forks source link

va_start() without va_end() #264

Open smuehlst opened 2 years ago

smuehlst commented 2 years ago

I stumbled over two places in the serialization code where va_start() is called without a corresponding call to va_end():

https://github.com/boostorg/serialization/blob/3f322d4adc3c88a667751ad66ce19217a3bba1f9/include/boost/serialization/extended_type_info_no_rtti.hpp#L130 https://github.com/boostorg/serialization/blob/3f322d4adc3c88a667751ad66ce19217a3bba1f9/include/boost/serialization/extended_type_info_typeid.hpp#L116

Is this intentional? According to my understanding of the C standard it is undefined behavior if va_end() is missing after va_start() has been called. See for example ISO/IEC 9899:TC3:

7.15.1 Variable argument list access macros ... 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. ... 7.15.1.3 The va_end macro ... 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.

SilverPlate3 commented 1 year ago

@robertramey Would you like me to create a pull request and fix this issue?