Skip to content

Fix vuln OSV-2024-382 #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from
Open

Fix vuln OSV-2024-382 #19

wants to merge 8 commits into from

Conversation

oss-patch
Copy link
Owner

No description provided.

oss-patch and others added 8 commits December 24, 2024 07:57
* Replaced MacAddress internal C-array with std::array.

* Lint

* Added <cstring> header to all places where removing <cstring> from MacAddress broke memset.

* Moved <cstring> include from cpp to header.

* Added <cstring> to PTF header as it uses memcmp in macros.
* Pulled ostream operators for IPAddress and MacAddress into the namespace to satisfy ADL requirements.

* Refactor of Logger.

- LogLevel is now a top level enum class.
- Added a new log level Off to disable output from a specific module.
- Logger::LogLevel is a deprecated alias to LogLevel.
- Logger::Info, Debug, Error are deprecated aliases to LogLevel::...
- Removed public "internal*" functions from Logger.Logger
- Added LogSource struct to encapsulate source information.
- Added shouldLog method to check if a log should be emitted for a given level and module.
- Removed nonfunctional artifacts "m_LogStream" and "Logger::operator<<"
- Added templated "log" functions that are friends to Logger.
- Reworked PCPP_LOG macros to no longer utilize the now removed internal functions.
- Added PCPP_LOG_INFO macro level.
- Changed PCPP_LOG_ERROR to now check if the log should be emitted.
- Fixed NetworkUtils log module name overlapping with NetworkUtils class.
- Fixed missing enum value for PacketLogModuleSll2Layer.

* Cleanup and fixes.

* Added the new Off log level to the string conversion.

* Fixed wrong variable name.

* Added documentation to log source.

* Lint.

* Fixed docstring for LogSource.

* Fixed extra /

* Fixed explicit warning.

* Moved log functions inside logger.

* Revert "Moved log functions inside logger."

This reverts commit be95ab8.

* Moved the log functions to the Logger class.

- Added optional compile time elimination of log calls below set level.

* Fixed typo in macro names.

* Changed value param to const-ref.

* Added "venv" and "./out" to ignored directories by codespell.

* Reverted to previous optimizations to keep executable binary size low.

- Renamed printLogMessage to emit and changed visibility to public.
- Added new class LogContext to encapsulate a single emittable log message.
- Added new methods createLogContext which is practically a rework of internalCreateLogStream but returns a LogContext.
- Added optional use of object pooling optimization for reusing log contexts. (Enabled via preprocessor flag PCPP_LOG_USE_OBJECT_POOL)

* Fixed warnings about unreferenced local variables if the compile time minimum log level set to too high severity..

* Removed useless variable.

* Fixed friend class definition.

* Fixed variable assignment.

* Added method useContextPooling to control if the logger should use context pooling.

- Removed preprocessor variable PCPP_LOG_USE_OBJECT_POOL.
- Disabled context pooling for the unit tests as it interferes with the memory leak checker.

* Fixed more warnings about unreferenced local variables if the compile time minimum log level set to too high severity..

* Addressed warnings and documentation.

- Added documentation to new methods and classes.
- Addressed explicit constructor warnings.
- Moved disable of context pooling for unit tests to the main.cpp files of the respective tests.

* Fixed include.

* Fixed pointer dereference.

* Fixed memory checker issues with logger.

- Added 2 preallocated log contexts to the object pool.

* Lint

* Added mutex lock on the default log printer to support proper multi-threading and eliminate possibility of data races during log emission.

* Fixed typos in documentation.

* Changed level variable to private.

* Changed LogPrinter definition to use the metaprogramming construct std::add_pointer.

* Replaced C library includes with C++ equivalents.

* Updated documentation format.

* Added full namespace qualifier for marco code.

* Changed  C-array to std::array.

* Added a mutex lock when writing or reading to last error string to prevent tearing.

* Fixed object pool member variables.

* Added mutators to change the max size of an object pool at runtime.

* Added exception if pool preallocation size is larger then the maximum allowed pool size.

* Added tests for ObjectPool<T>.

- Changed infinite pool size to be maximum value of size_t instead of 0, to fix an issue if max size is set to 0.
- Added size getter to the pool.
- Marked the pool mutex as mutable.

* Lint

* Added option to set the max pool size for the Logger context pool.

* Disabled logger context pooling in the tests as it is detected as a false positive memory leak.

* Lint

* Lint

* Updated logger tests.

- Changed `pcpp::Logger::getInstance()` to use a cached `logger` variable.
- Removed the need for fully qualified names in the logger test.
- C-style casts to Cpp casts.

* Added tests for `shouldLog`.

* Moved iostream and iomanip to Logger.cpp as they are unnessesary in the header.

* Lint

* Added iostream to examples that depended on transitively including iostream from Logger.h

* Added <iomanip> to examples that depended on transitively including from Logger.h

* Moved ObjectPool to internal namespace.

* Renamed ObjectPool to DynamicObjectPool.

* Renamed preallocate ctor parameter to initialSize.

* Removed unused logging functions.

* Fixed missed include <cstring>.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants