apache / apache/rocketmq-client-cpp
string terminator '\0' should be considered here
- Lenguaje dominante
- C++
- Estrellas
- 393
- Forks
- 167
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
string terminator '\0' should be considered here:
https://github.com/apache/rocketmq-client-cpp/blob/9008c14d9c34a4f0b4a67417000612348157027e/src/common/ClientRPCHook.cpp#L56
I use `valgrind` to run my program, it always prompts the following error. According to the source code, this should be because there is no string terminator `\0`
```
==31201== Thread 17:
==31201== Invalid read of size 1
==31201== at 0x4869EE1: vfprintf (in /usr/lib/libc-2.17.so)
==31201== by 0x4890E62: vsnprintf (in /usr/lib/libc-2.17.so)
==31201== by 0x43614A2: rocketmq::LogUtil::LogMessageFull(boost::log::v2s_mt_posix::trivial::severity_level, char const*, char const*, int, char const*, ...) (Logging.h:88)
==31201== by 0x436914C: rocketmq::ClientRPCHook::doBeforeRequest(std::string const&, rocketmq::RemotingCommand&) (ClientRPCHook.cpp:56)
==31201== by 0x44015FA: rocketmq::MQClientAPIImpl::callSignatureBeforeRequest(std::string const&, rocketmq::RemotingCommand&, rocketmq::SessionCredentials const&) (MQClientAPIImpl.cpp:181)
==31201== by 0x4404000: rocketmq::MQClientAPIImpl::sendHeartbeat(std::string const&, rocketmq::HeartbeatData*, rocketmq::SessionCredentials const&) (MQClientAPIImpl.cpp:273)
==31201== by 0x4357A1F: rocketmq::MQClientFactory::sendHeartbeatToAllBroker() (MQClientFactory.cpp:796)
==31201== by 0x4355D64: rocketmq::MQClientFactory::timerCB_sendHeartbeatToAllBroker(boost::system::error_code&, boost::shared_ptr, boost::asio::deadline_timer_service > > >) (MQClientFactory.cpp:838)
==31201== by 0x435C1E9: operator() (mem_fn_template.hpp:280)
==31201== by 0x435C1E9: operator() > >, boost::_bi::list1 > (bind.hpp:392)
==31201== by 0x435C1E9: operator() (bind.hpp:905)
==31201== by 0x435C1E9: operator() (bind_handler.hpp:47)
==31201== by 0x435C1E9: asio_handler_invoke > >, boost::_bi::list3, boost::_bi::value, boost::_bi::value > > > >, boost::system::error_code> > (handler_invoke_hook.hpp:69)
==31201== by 0x435C1E9: invoke > >, boost::_bi::list3, boost::_bi::value, boost::_bi::value > > > >, boost::system::error_code>, boost::_bi::bind_t > >, boost::_bi::list3, boost::_bi::value, boost::_bi::value > > > > > (handler_invoke_helpers.hpp:37)
==31201== by 0x435C1E9: boost::asio::detail::wait_handler, boost::asio::deadline_timer_service > > > >, boost::_bi::list3, boost::_bi::value, boost::_bi::value, boost::asio::deadline_timer_service > > > > > > >::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned int) (wait_handler.hpp:70)
==31201== by 0x435DCC8: complete (task_io_service_operation.hpp:38)
==31201== by 0x435DCC8: do_run_one (task_io_service.ipp:372)
==31201== by 0x435DCC8: boost::asio::detail::task_io_service::run(boost::system::error_code&) (task_io_service.ipp:149)
==31201== by 0x435677B: run (io_service.ipp:66)
==31201== by 0x435677B: rocketmq::MQClientFactory::startScheduledTask(bool) (MQClientFactory.cpp:893)
==31201== by 0x4358276: operator() (mem_fn_template.hpp:165)
==31201== by 0x4358276: operator(), boost::_bi::list0> (bind.hpp:313)
==31201== by 0x4358276: operator() (bind.hpp:893)
==31201== by 0x4358276: boost::detail::thread_data, boost::_bi::list2, boost::_bi::value > > >::run() (thread.hpp:116)
==31201== Address 0x570f2f9 is 0 bytes after a block of size 337 alloc'd
==31201== at 0x402B2D8: malloc (vg_replace_malloc.c:299)
==31201== by 0x43721CF: rocketmq::MemoryBlock::setSize(int, bool) (dataBlock.cpp:110)
==31201== by 0x43ECD77: rocketmq::RemotingCommand::SetBody(char const*, int) (RemotingCommand.cpp:140)
==31201== by 0x4403FD2: rocketmq::MQClientAPIImpl::sendHeartbeat(std::string const&, rocketmq::HeartbeatData*, rocketmq::SessionCredentials const&) (MQClientAPIImpl.cpp:271)
==31201== by 0x4357A1F: rocketmq::MQClientFactory::sendHeartbeatToAllBroker() (MQClientFactory.cpp:796)
```
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.