[Live-devel] Fwd: Valgrind uninitialised values inside live555

Костромин Дмитрий Андреевич kostromin at bolid.ru
Wed Aug 18 02:54:57 PDT 2021


Sorry not leaks - but uninitialised value - I made a reservation.

-------- Перенаправленное сообщение --------
Тема: 	Re: [Live-devel] Valgrind uninitialised values inside live555
Дата: 	Wed, 18 Aug 2021 12:51:40 +0300
От: 	Костромин Дмитрий Андреевич <kostromin at bolid.ru>
Кому: 	live-devel at lists.live555.com



18.08.2021 10:12, Ross Finlayson пишет:
>> On Aug 17, 2021, at 11:25 PM, Ulrich Teichert 
>> <ulrich.teichert at luminator.com> wrote:
>>
>> In setPortNum, testAddr.ss_family is read to find out if an IP4 or 
>> IP6 address is being
>> dealt with:
> Yes, and this was fixed in the most recent release (2021.08.17) of the 
> code.
>
>
> Ross Finlayson
> Live Networks, Inc.
> http://www.live555.com/
>
>
> _______________________________________________
> live-devel mailing list
> live-devel at lists.live555.com
> http://lists.live555.com/mailman/listinfo/live-devel

Now i builded version release (2021.08.17) - but some leaks still 
persists. See log below


==115264== Thread 23:
==115264== Conditional jump or move depends on uninitialised value(s)
==115264==    at 0x6507BD7: readSocket(UsageEnvironment&, int, unsigned 
char*, unsigned int, sockaddr_storage&) (GroupsockHelper.cpp:411)
==115264==    by 0x6479EFA: SocketDescriptor::tcpReadHandler1(int) 
(RTPInterface.cpp:510)
==115264==    by 0x647A0CA: 
SocketDescriptor::tcpReadHandler(SocketDescriptor*, int) 
(RTPInterface.cpp:493)
==115264==    by 0x63BB33A: BasicTaskScheduler::SingleStep(unsigned int) 
(BasicTaskScheduler.cpp:171)
==115264==    by 0x63BA452: BasicTaskScheduler0::doEventLoop(char 
volatile*) (BasicTaskScheduler0.cpp:80)
==115264==    by 0x3ABB91: video_network::rtsp_player::run() 
(rtsp_player.cpp:591)
==115264==    by 0x3B4E71: void std::__invoke_impl<void, void 
(video_network::rtsp_player::*)(), 
video_network::rtsp_player*>(std::__invoke_memfun_deref, void 
(video_network::rtsp_player::*&&)(), video_network::rtsp_player*&&) 
(invoke.h:73)
==115264==    by 0x3B4DA0: std::__invoke_result<void 
(video_network::rtsp_player::*)(), video_network::rtsp_player*>::type 
std::__invoke<void (video_network::rtsp_player::*)(), 
video_network::rtsp_player*>(void (video_network::rtsp_player::*&&)(), 
video_network::rtsp_player*&&) (invoke.h:95)
==115264==    by 0x3B4D00: void std::thread::_Invoker<std::tuple<void 
(video_network::rtsp_player::*)(), video_network::rtsp_player*>
> ::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) (thread:264)
==115264==    by 0x3B4CB5: std::thread::_Invoker<std::tuple<void 
(video_network::rtsp_player::*)(), video_network::rtsp_player*>
> ::operator()() (thread:271)
==115264==    by 0x3B4B37: 
std::thread::_State_impl<std::thread::_Invoker<std::tuple<void 
(video_network::rtsp_player::*)(), video_network::rtsp_player*> >
> ::_M_run() (thread:215)
==115264==    by 0x697BDE3: ??? (in 
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==115264==
==115264== Conditional jump or move depends on uninitialised value(s)
==115264==    at 0x6507BDD: readSocket(UsageEnvironment&, int, unsigned 
char*, unsigned int, sockaddr_storage&) (GroupsockHelper.cpp:411)
==115264==    by 0x6479EFA: SocketDescriptor::tcpReadHandler1(int) 
(RTPInterface.cpp:510)
==115264==    by 0x647A0CA: 
SocketDescriptor::tcpReadHandler(SocketDescriptor*, int) 
(RTPInterface.cpp:493)
==115264==    by 0x63BB33A: BasicTaskScheduler::SingleStep(unsigned int) 
(BasicTaskScheduler.cpp:171)
==115264==    by 0x63BA452: BasicTaskScheduler0::doEventLoop(char 
volatile*) (BasicTaskScheduler0.cpp:80)
==115264==    by 0x3ABB91: video_network::rtsp_player::run() 
(rtsp_player.cpp:591)
==115264==    by 0x3B4E71: void std::__invoke_impl<void, void 
(video_network::rtsp_player::*)(), 
video_network::rtsp_player*>(std::__invoke_memfun_deref, void 
(video_network::rtsp_player::*&&)(), video_network::rtsp_player*&&) 
(invoke.h:73)
==115264==    by 0x3B4DA0: std::__invoke_result<void 
(video_network::rtsp_player::*)(), video_network::rtsp_player*>::type 
std::__invoke<void (video_network::rtsp_player::*)(), 
video_network::rtsp_player*>(void (video_network::rtsp_player::*&&)(), 
video_network::rtsp_player*&&) (invoke.h:95)
==115264==    by 0x3B4D00: void std::thread::_Invoker<std::tuple<void 
(video_network::rtsp_player::*)(), video_network::rtsp_player*>
> ::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) (thread:264)
==115264==    by 0x3B4CB5: std::thread::_Invoker<std::tuple<void 
(video_network::rtsp_player::*)(), video_network::rtsp_player*>
> ::operator()() (thread:271)
==115264==    by 0x3B4B37: 
std::thread::_State_impl<std::thread::_Invoker<std::tuple<void 
(video_network::rtsp_player::*)(), video_network::rtsp_player*> >
> ::_M_run() (thread:215)
==115264==    by 0x697BDE3: ??? (in 
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)
==115264==
==115264== Conditional jump or move depends on uninitialised value(s)
==115264==    at 0x6509858: 
Groupsock::wasLoopedBackFromUs(UsageEnvironment&, sockaddr_storage 
const&) (Groupsock.cpp:319)
==115264==    by 0x647AFD2: RTCPInstance::incomingReportHandler1() 
(RTCP.cpp:460)
==115264==    by 0x647A028: SocketDescriptor::tcpReadHandler1(int) 
(RTPInterface.cpp:589)
==115264==    by 0x647A0CA: 
SocketDescriptor::tcpReadHandler(SocketDescriptor*, int) 
(RTPInterface.cpp:493)
==115264==    by 0x63BB33A: BasicTaskScheduler::SingleStep(unsigned int) 
(BasicTaskScheduler.cpp:171)
==115264==    by 0x63BA452: BasicTaskScheduler0::doEventLoop(char 
volatile*) (BasicTaskScheduler0.cpp:80)
==115264==    by 0x3ABB91: video_network::rtsp_player::run() 
(rtsp_player.cpp:591)
==115264==    by 0x3B4E71: void std::__invoke_impl<void, void 
(video_network::rtsp_player::*)(), 
video_network::rtsp_player*>(std::__invoke_memfun_deref, void 
(video_network::rtsp_player::*&&)(), video_network::rtsp_player*&&) 
(invoke.h:73)
==115264==    by 0x3B4DA0: std::__invoke_result<void 
(video_network::rtsp_player::*)(), video_network::rtsp_player*>::type 
std::__invoke<void (video_network::rtsp_player::*)(), 
video_network::rtsp_player*>(void (video_network::rtsp_player::*&&)(), 
video_network::rtsp_player*&&) (invoke.h:95)
==115264==    by 0x3B4D00: void std::thread::_Invoker<std::tuple<void 
(video_network::rtsp_player::*)(), video_network::rtsp_player*>
> ::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) (thread:264)
==115264==    by 0x3B4CB5: std::thread::_Invoker<std::tuple<void 
(video_network::rtsp_player::*)(), video_network::rtsp_player*>
> ::operator()() (thread:271)
==115264==    by 0x3B4B37: 
std::thread::_State_impl<std::thread::_Invoker<std::tuple<void 
(video_network::rtsp_player::*)(), video_network::rtsp_player*> >
> ::_M_run() (thread:215)
==115264==
==115264== Conditional jump or move depends on uninitialised value(s)
==115264==    at 0x6507BD7: readSocket(UsageEnvironment&, int, unsigned 
char*, unsigned int, sockaddr_storage&) (GroupsockHelper.cpp:411)
==115264==    by 0x64794A8: RTPInterface::handleRead(unsigned char*, 
unsigned int, unsigned int&, sockaddr_storage&, int&, unsigned char&, 
unsigned char&) (RTPInterface.cpp:285)
==115264==    by 0x6472A3B: BufferedPacket::fillInData(RTPInterface&, 
sockaddr_storage&, unsigned char&) (MultiFramedRTPSource.cpp:405)
==115264==    by 0x6473812: MultiFramedRTPSource::networkReadHandler1() 
(MultiFramedRTPSource.cpp:241)
==115264==    by 0x647A028: SocketDescriptor::tcpReadHandler1(int) 
(RTPInterface.cpp:589)
==115264==    by 0x647A0CA: 
SocketDescriptor::tcpReadHandler(SocketDescriptor*, int) 
(RTPInterface.cpp:493)
==115264==    by 0x63BB33A: BasicTaskScheduler::SingleStep(unsigned int) 
(BasicTaskScheduler.cpp:171)
==115264==    by 0x63BA452: BasicTaskScheduler0::doEventLoop(char 
volatile*) (BasicTaskScheduler0.cpp:80)
==115264==    by 0x3ABB91: video_network::rtsp_player::run() 
(rtsp_player.cpp:591)
==115264==    by 0x3B4E71: void std::__invoke_impl<void, void 
(video_network::rtsp_player::*)(), 
video_network::rtsp_player*>(std::__invoke_memfun_deref, void 
(video_network::rtsp_player::*&&)(), video_network::rtsp_player*&&) 
(invoke.h:73)
==115264==    by 0x3B4DA0: std::__invoke_result<void 
(video_network::rtsp_player::*)(), video_network::rtsp_player*>::type 
std::__invoke<void (video_network::rtsp_player::*)(), 
video_network::rtsp_player*>(void (video_network::rtsp_player::*&&)(), 
video_network::rtsp_player*&&) (invoke.h:95)
==115264==    by 0x3B4D00: void std::thread::_Invoker<std::tuple<void 
(video_network::rtsp_player::*)(), video_network::rtsp_player*>
> ::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) (thread:264)
==115264==
==115264== Conditional jump or move depends on uninitialised value(s)
==115264==    at 0x6507BDD: readSocket(UsageEnvironment&, int, unsigned 
char*, unsigned int, sockaddr_storage&) (GroupsockHelper.cpp:411)
==115264==    by 0x64794A8: RTPInterface::handleRead(unsigned char*, 
unsigned int, unsigned int&, sockaddr_storage&, int&, unsigned char&, 
unsigned char&) (RTPInterface.cpp:285)
==115264==    by 0x6472A3B: BufferedPacket::fillInData(RTPInterface&, 
sockaddr_storage&, unsigned char&) (MultiFramedRTPSource.cpp:405)
==115264==    by 0x6473812: MultiFramedRTPSource::networkReadHandler1() 
(MultiFramedRTPSource.cpp:241)
==115264==    by 0x647A028: SocketDescriptor::tcpReadHandler1(int) 
(RTPInterface.cpp:589)
==115264==    by 0x647A0CA: 
SocketDescriptor::tcpReadHandler(SocketDescriptor*, int) 
(RTPInterface.cpp:493)
==115264==    by 0x63BB33A: BasicTaskScheduler::SingleStep(unsigned int) 
(BasicTaskScheduler.cpp:171)
==115264==    by 0x63BA452: BasicTaskScheduler0::doEventLoop(char 
volatile*) (BasicTaskScheduler0.cpp:80)
==115264==    by 0x3ABB91: video_network::rtsp_player::run() 
(rtsp_player.cpp:591)
==115264==    by 0x3B4E71: void std::__invoke_impl<void, void 
(video_network::rtsp_player::*)(), 
video_network::rtsp_player*>(std::__invoke_memfun_deref, void 
(video_network::rtsp_player::*&&)(), video_network::rtsp_player*&&) 
(invoke.h:73)
==115264==    by 0x3B4DA0: std::__invoke_result<void 
(video_network::rtsp_player::*)(), video_network::rtsp_player*>::type 
std::__invoke<void (video_network::rtsp_player::*)(), 
video_network::rtsp_player*>(void (video_network::rtsp_player::*&&)(), 
video_network::rtsp_player*&&) (invoke.h:95)
==115264==    by 0x3B4D00: void std::thread::_Invoker<std::tuple<void 
(video_network::rtsp_player::*)(), video_network::rtsp_player*>
> ::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) (thread:264)
==115264==
==115264==

I found this issue - it is in MultiFramedRTPSource.cpp :

void MultiFramedRTPSource::networkReadHandler1() {
   BufferedPacket* bPacket = fPacketReadInProgress;
   if (bPacket == NULL) {
     // Normal case: Get a free BufferedPacket descriptor to hold the 
new network packet:
     bPacket = fReorderingBuffer->getFreePacket(this);
   }

   // Read the network packet, and perform sanity checks on the RTP header:
   Boolean readSuccess = False;
   do {
     struct sockaddr_storage fromAddress;
     Boolean packetReadWasIncomplete = fPacketReadInProgress != NULL;
     if (!bPacket->fillInData(fRTPInterface, fromAddress, 
packetReadWasIncomplete)) {
       if (bPacket->bytesAvailable() == 0) { // should not happen??
     envir() << "MultiFramedRTPSource internal error: Hit limit when 
reading incoming packet over TCP\n";
       }


struct sockaddr_storage fromAddress; again ununitialized here.

And if we going through the stack into GroupsockHelper.cpp:411 - again 
switch (from Address.sa_family)

int readSocket(UsageEnvironment& env,
            int socket, unsigned char* buffer, unsigned bufferSize,
            struct sockaddr_storage& fromAddress) {
   SOCKLEN_T addressSize = sizeof fromAddress;
   int bytesRead = recvfrom(socket, (char*)buffer, bufferSize, 0,
                (struct sockaddr*)&fromAddress,
                &addressSize);
   if (bytesRead < 0) {
     //##### HACK to work around bugs in Linux and Windows:
     int err = env.getErrno();
     if (err == 111 /*ECONNREFUSED (Linux)*/
#if defined(__WIN32__) || defined(_WIN32)
     // What a piece of crap Windows is.  Sometimes
     // recvfrom() returns -1, but with an 'errno' of 0.
     // This appears not to be a real error; just treat
     // it as if it were a read of zero bytes, and hope
     // we don't have to do anything else to 'reset'
     // this alleged error:
     || err == 0 || err == EWOULDBLOCK
#else
     || err == EAGAIN
#endif
     || err == 113 /*EHOSTUNREACH (Linux)*/) { // Why does Linux return 
this for datagram sock?
       switch (fromAddress.ss_family) {
     case AF_INET: {
       ((sockaddr_in&)fromAddress).sin_addr.s_addr = 0;
       break;
     }
         case AF_INET6: {
       for (unsigned i = 0; i < 16; ++i) 
((sockaddr_in6&)fromAddress).sin6_addr.s6_addr[i] = 0;
       break;
     }
       }
       return 0;
     }
     //##### END HACK
     socketErr(env, "recvfrom() error: ");
   } else if (bytesRead == 0) {
     // "recvfrom()" on a stream socket can return 0 if the remote end 
has closed the connection.  Treat this as an error:
     return -1;
   }

   return bytesRead;
}

here :

   switch (fromAddress.ss_family) {
     case AF_INET: {
       ((sockaddr_in&)fromAddress).sin_addr.s_addr = 0;
       break;
     }
         case AF_INET6: {
       for (unsigned i = 0; i < 16; ++i) 
((sockaddr_in6&)fromAddress).sin6_addr.s6_addr[i] = 0;
       break;
     }

-- 
С уважением, Костромин Дмитрий Андреевич,
руководитель подразделения ЗАО НВП "Болид"
г.Орехово-Зуево

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20210818/87b531e3/attachment-0001.htm>


More information about the live-devel mailing list