jbeder / yaml-cpp

A YAML parser and emitter in C++
MIT License
4.91k stars 1.77k forks source link

Reference binding to null pointer @ Binary::data() #1248

Open prigluchenie opened 7 months ago

prigluchenie commented 7 months ago

Default constructed Binary makes UB here https://github.com/jbeder/yaml-cpp/blob/eaf72053724814be3b99d38e292fca5797a57b7b/include/yaml-cpp/binary.h#L33

m_data[0] is illegal for empty vector. Using vector::data() member is a proper way.

Clang UB sanitizer reports "Reference binding to null pointer" here.