abumq / easyloggingpp

C++ logging library. It is powerful, supports asynchronous low latency, extendable, light-weight, fast performing, thread and type safe and consists of many built-in features. It provides ability to write logs in your own customized format. It also provide support for logging your classes, third-party libraries, STL and third-party containers etc.
MIT License
3.75k stars 918 forks source link

Uninitialized memory use in copy constuctor #795

Open dimalinux opened 3 years ago

dimalinux commented 3 years ago

https://github.com/amrayn/easyloggingpp/blob/8489989bb26c6371df103f6cbced3fbee1bc3c2f/src/easylogging%2B%2B.cc#L623

That line is passing uninitialized memory to safeDelete and if it is non-zero, it is calling delete.

simoc commented 2 years ago

I think the next method in easylogging++.cc has the same problem too:

https://github.com/amrayn/easyloggingpp/blob/8489989bb26c6371df103f6cbced3fbee1bc3c2f/src/easylogging%2B%2B.cc#L635

What is the best solution?

  1. Remove these two lines, because they are not needed.

or,

  1. Initialize member m_typedConfigurations to nullptr in the class definition of Logger in easylogging++.h