metsw24-max opened a new pull request, #679:
URL: https://github.com/apache/logging-log4cxx/pull/679
Fixed a concrete library-side null-pointer dereference in
ByteArrayOutputStream.
After storage was moved into ByteArrayOutputStreamPriv, the default
constructor no longer initialized the private unique_ptr. As a result, every
call into write() or toByteArray() dereferenced a null pointer through accesses
such as:
- m_priv->array.size()
- m_priv->array.resize(...)
- &m_priv->array[sz]
This was a real crash in normal API usage (construct -> write -> read), not
caller misuse.
Changes
- src/main/cpp/bytearrayoutputstream.cpp
- Initialize m_priv in the default constructor using:
std::make_unique<ByteArrayOutputStreamPriv>()
- src/test/cpp/helpers/casttestcase.cpp
- Added testByteArrayOutputStreamWriteAfterDefaultConstruction
- The test:
- default-constructs ByteArrayOutputStream
- writes 7 bytes through write()
- validates the round-trip through toByteArray()
- Without the fix, the test crashes on the first write() call.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]