<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><br>
    </p>
    <div class="moz-forward-container">Sorry not leaks - but
      uninitialised value - I made a reservation.<br>
      <br>
      -------- Перенаправленное сообщение --------
      <table class="moz-email-headers-table" cellspacing="0"
        cellpadding="0" border="0">
        <tbody>
          <tr>
            <th valign="BASELINE" nowrap="nowrap" align="RIGHT">Тема: </th>
            <td>Re: [Live-devel] Valgrind uninitialised values inside
              live555</td>
          </tr>
          <tr>
            <th valign="BASELINE" nowrap="nowrap" align="RIGHT">Дата: </th>
            <td>Wed, 18 Aug 2021 12:51:40 +0300</td>
          </tr>
          <tr>
            <th valign="BASELINE" nowrap="nowrap" align="RIGHT">От: </th>
            <td>Костромин Дмитрий Андреевич <a class="moz-txt-link-rfc2396E" href="mailto:kostromin@bolid.ru"><kostromin@bolid.ru></a></td>
          </tr>
          <tr>
            <th valign="BASELINE" nowrap="nowrap" align="RIGHT">Кому: </th>
            <td><a class="moz-txt-link-abbreviated" href="mailto:live-devel@lists.live555.com">live-devel@lists.live555.com</a></td>
          </tr>
        </tbody>
      </table>
      <br>
      <br>
      18.08.2021 10:12, Ross Finlayson пишет:<br>
      <blockquote type="cite">
        <blockquote type="cite">On Aug 17, 2021, at 11:25 PM, Ulrich
          Teichert <a class="moz-txt-link-rfc2396E" href="mailto:ulrich.teichert@luminator.com"><ulrich.teichert@luminator.com></a> wrote:<br>
          <br>
          In setPortNum, testAddr.ss_family is read to find out if an
          IP4 or IP6 address is being<br>
          dealt with:<br>
        </blockquote>
        Yes, and this was fixed in the most recent release (2021.08.17)
        of the code.<br>
        <br>
        <br>
        Ross Finlayson<br>
        Live Networks, Inc.<br>
        <a class="moz-txt-link-freetext" href="http://www.live555.com/">http://www.live555.com/</a><br>
        <br>
        <br>
        _______________________________________________<br>
        live-devel mailing list<br>
        <a class="moz-txt-link-abbreviated" href="mailto:live-devel@lists.live555.com">live-devel@lists.live555.com</a><br>
        <a class="moz-txt-link-freetext" href="http://lists.live555.com/mailman/listinfo/live-devel">http://lists.live555.com/mailman/listinfo/live-devel</a><br>
      </blockquote>
      <br>
      Now i builded version release (2021.08.17) - but some leaks still
      persists. See log below<br>
      <br>
      <br>
      ==115264== Thread 23:<br>
      ==115264== Conditional jump or move depends on uninitialised
      value(s)<br>
      ==115264==    at 0x6507BD7: readSocket(UsageEnvironment&, int,
      unsigned char*, unsigned int, sockaddr_storage&)
      (GroupsockHelper.cpp:411)<br>
      ==115264==    by 0x6479EFA: SocketDescriptor::tcpReadHandler1(int)
      (RTPInterface.cpp:510)<br>
      ==115264==    by 0x647A0CA:
      SocketDescriptor::tcpReadHandler(SocketDescriptor*, int)
      (RTPInterface.cpp:493)<br>
      ==115264==    by 0x63BB33A:
      BasicTaskScheduler::SingleStep(unsigned int)
      (BasicTaskScheduler.cpp:171)<br>
      ==115264==    by 0x63BA452: BasicTaskScheduler0::doEventLoop(char
      volatile*) (BasicTaskScheduler0.cpp:80)<br>
      ==115264==    by 0x3ABB91: video_network::rtsp_player::run()
      (rtsp_player.cpp:591)<br>
      ==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)<br>
      ==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)<br>
      ==115264==    by 0x3B4D00: void
      std::thread::_Invoker<std::tuple<void
      (video_network::rtsp_player::*)(), video_network::rtsp_player*>
      <blockquote type="cite">::_M_invoke<0ul,
        1ul>(std::_Index_tuple<0ul, 1ul>) (thread:264)<br>
      </blockquote>
      ==115264==    by 0x3B4CB5:
      std::thread::_Invoker<std::tuple<void
      (video_network::rtsp_player::*)(), video_network::rtsp_player*>
      <blockquote type="cite">::operator()() (thread:271)<br>
      </blockquote>
      ==115264==    by 0x3B4B37:
      std::thread::_State_impl<std::thread::_Invoker<std::tuple<void
      (video_network::rtsp_player::*)(), video_network::rtsp_player*>
      >
      <blockquote type="cite">::_M_run() (thread:215)<br>
      </blockquote>
      ==115264==    by 0x697BDE3: ??? (in
      /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)<br>
      ==115264==<br>
      ==115264== Conditional jump or move depends on uninitialised
      value(s)<br>
      ==115264==    at 0x6507BDD: readSocket(UsageEnvironment&, int,
      unsigned char*, unsigned int, sockaddr_storage&)
      (GroupsockHelper.cpp:411)<br>
      ==115264==    by 0x6479EFA: SocketDescriptor::tcpReadHandler1(int)
      (RTPInterface.cpp:510)<br>
      ==115264==    by 0x647A0CA:
      SocketDescriptor::tcpReadHandler(SocketDescriptor*, int)
      (RTPInterface.cpp:493)<br>
      ==115264==    by 0x63BB33A:
      BasicTaskScheduler::SingleStep(unsigned int)
      (BasicTaskScheduler.cpp:171)<br>
      ==115264==    by 0x63BA452: BasicTaskScheduler0::doEventLoop(char
      volatile*) (BasicTaskScheduler0.cpp:80)<br>
      ==115264==    by 0x3ABB91: video_network::rtsp_player::run()
      (rtsp_player.cpp:591)<br>
      ==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)<br>
      ==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)<br>
      ==115264==    by 0x3B4D00: void
      std::thread::_Invoker<std::tuple<void
      (video_network::rtsp_player::*)(), video_network::rtsp_player*>
      <blockquote type="cite">::_M_invoke<0ul,
        1ul>(std::_Index_tuple<0ul, 1ul>) (thread:264)<br>
      </blockquote>
      ==115264==    by 0x3B4CB5:
      std::thread::_Invoker<std::tuple<void
      (video_network::rtsp_player::*)(), video_network::rtsp_player*>
      <blockquote type="cite">::operator()() (thread:271)<br>
      </blockquote>
      ==115264==    by 0x3B4B37:
      std::thread::_State_impl<std::thread::_Invoker<std::tuple<void
      (video_network::rtsp_player::*)(), video_network::rtsp_player*>
      >
      <blockquote type="cite">::_M_run() (thread:215)<br>
      </blockquote>
      ==115264==    by 0x697BDE3: ??? (in
      /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.28)<br>
      ==115264==<br>
      ==115264== Conditional jump or move depends on uninitialised
      value(s)<br>
      ==115264==    at 0x6509858:
      Groupsock::wasLoopedBackFromUs(UsageEnvironment&,
      sockaddr_storage const&) (Groupsock.cpp:319)<br>
      ==115264==    by 0x647AFD2: RTCPInstance::incomingReportHandler1()
      (RTCP.cpp:460)<br>
      ==115264==    by 0x647A028: SocketDescriptor::tcpReadHandler1(int)
      (RTPInterface.cpp:589)<br>
      ==115264==    by 0x647A0CA:
      SocketDescriptor::tcpReadHandler(SocketDescriptor*, int)
      (RTPInterface.cpp:493)<br>
      ==115264==    by 0x63BB33A:
      BasicTaskScheduler::SingleStep(unsigned int)
      (BasicTaskScheduler.cpp:171)<br>
      ==115264==    by 0x63BA452: BasicTaskScheduler0::doEventLoop(char
      volatile*) (BasicTaskScheduler0.cpp:80)<br>
      ==115264==    by 0x3ABB91: video_network::rtsp_player::run()
      (rtsp_player.cpp:591)<br>
      ==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)<br>
      ==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)<br>
      ==115264==    by 0x3B4D00: void
      std::thread::_Invoker<std::tuple<void
      (video_network::rtsp_player::*)(), video_network::rtsp_player*>
      <blockquote type="cite">::_M_invoke<0ul,
        1ul>(std::_Index_tuple<0ul, 1ul>) (thread:264)<br>
      </blockquote>
      ==115264==    by 0x3B4CB5:
      std::thread::_Invoker<std::tuple<void
      (video_network::rtsp_player::*)(), video_network::rtsp_player*>
      <blockquote type="cite">::operator()() (thread:271)<br>
      </blockquote>
      ==115264==    by 0x3B4B37:
      std::thread::_State_impl<std::thread::_Invoker<std::tuple<void
      (video_network::rtsp_player::*)(), video_network::rtsp_player*>
      >
      <blockquote type="cite">::_M_run() (thread:215)<br>
      </blockquote>
      ==115264==<br>
      ==115264== Conditional jump or move depends on uninitialised
      value(s)<br>
      ==115264==    at 0x6507BD7: readSocket(UsageEnvironment&, int,
      unsigned char*, unsigned int, sockaddr_storage&)
      (GroupsockHelper.cpp:411)<br>
      ==115264==    by 0x64794A8: RTPInterface::handleRead(unsigned
      char*, unsigned int, unsigned int&, sockaddr_storage&,
      int&, unsigned char&, unsigned char&)
      (RTPInterface.cpp:285)<br>
      ==115264==    by 0x6472A3B:
      BufferedPacket::fillInData(RTPInterface&,
      sockaddr_storage&, unsigned char&)
      (MultiFramedRTPSource.cpp:405)<br>
      ==115264==    by 0x6473812:
      MultiFramedRTPSource::networkReadHandler1()
      (MultiFramedRTPSource.cpp:241)<br>
      ==115264==    by 0x647A028: SocketDescriptor::tcpReadHandler1(int)
      (RTPInterface.cpp:589)<br>
      ==115264==    by 0x647A0CA:
      SocketDescriptor::tcpReadHandler(SocketDescriptor*, int)
      (RTPInterface.cpp:493)<br>
      ==115264==    by 0x63BB33A:
      BasicTaskScheduler::SingleStep(unsigned int)
      (BasicTaskScheduler.cpp:171)<br>
      ==115264==    by 0x63BA452: BasicTaskScheduler0::doEventLoop(char
      volatile*) (BasicTaskScheduler0.cpp:80)<br>
      ==115264==    by 0x3ABB91: video_network::rtsp_player::run()
      (rtsp_player.cpp:591)<br>
      ==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)<br>
      ==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)<br>
      ==115264==    by 0x3B4D00: void
      std::thread::_Invoker<std::tuple<void
      (video_network::rtsp_player::*)(), video_network::rtsp_player*>
      <blockquote type="cite">::_M_invoke<0ul,
        1ul>(std::_Index_tuple<0ul, 1ul>) (thread:264)<br>
      </blockquote>
      ==115264==<br>
      ==115264== Conditional jump or move depends on uninitialised
      value(s)<br>
      ==115264==    at 0x6507BDD: readSocket(UsageEnvironment&, int,
      unsigned char*, unsigned int, sockaddr_storage&)
      (GroupsockHelper.cpp:411)<br>
      ==115264==    by 0x64794A8: RTPInterface::handleRead(unsigned
      char*, unsigned int, unsigned int&, sockaddr_storage&,
      int&, unsigned char&, unsigned char&)
      (RTPInterface.cpp:285)<br>
      ==115264==    by 0x6472A3B:
      BufferedPacket::fillInData(RTPInterface&,
      sockaddr_storage&, unsigned char&)
      (MultiFramedRTPSource.cpp:405)<br>
      ==115264==    by 0x6473812:
      MultiFramedRTPSource::networkReadHandler1()
      (MultiFramedRTPSource.cpp:241)<br>
      ==115264==    by 0x647A028: SocketDescriptor::tcpReadHandler1(int)
      (RTPInterface.cpp:589)<br>
      ==115264==    by 0x647A0CA:
      SocketDescriptor::tcpReadHandler(SocketDescriptor*, int)
      (RTPInterface.cpp:493)<br>
      ==115264==    by 0x63BB33A:
      BasicTaskScheduler::SingleStep(unsigned int)
      (BasicTaskScheduler.cpp:171)<br>
      ==115264==    by 0x63BA452: BasicTaskScheduler0::doEventLoop(char
      volatile*) (BasicTaskScheduler0.cpp:80)<br>
      ==115264==    by 0x3ABB91: video_network::rtsp_player::run()
      (rtsp_player.cpp:591)<br>
      ==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)<br>
      ==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)<br>
      ==115264==    by 0x3B4D00: void
      std::thread::_Invoker<std::tuple<void
      (video_network::rtsp_player::*)(), video_network::rtsp_player*>
      <blockquote type="cite">::_M_invoke<0ul,
        1ul>(std::_Index_tuple<0ul, 1ul>) (thread:264)<br>
      </blockquote>
      ==115264==<br>
      ==115264==<br>
      <br>
      I found this issue - it is in MultiFramedRTPSource.cpp :<br>
      <br>
      void MultiFramedRTPSource::networkReadHandler1() {<br>
        BufferedPacket* bPacket = fPacketReadInProgress;<br>
        if (bPacket == NULL) {<br>
          // Normal case: Get a free BufferedPacket descriptor to hold
      the new network packet:<br>
          bPacket = fReorderingBuffer->getFreePacket(this);<br>
        }<br>
      <br>
        // Read the network packet, and perform sanity checks on the RTP
      header:<br>
        Boolean readSuccess = False;<br>
        do {<br>
          struct sockaddr_storage fromAddress;<br>
          Boolean packetReadWasIncomplete = fPacketReadInProgress !=
      NULL;<br>
          if (!bPacket->fillInData(fRTPInterface, fromAddress,
      packetReadWasIncomplete)) {<br>
            if (bPacket->bytesAvailable() == 0) { // should not
      happen??<br>
          envir() << "MultiFramedRTPSource internal error: Hit
      limit when reading incoming packet over TCP\n";<br>
            }<br>
      <br>
      <br>
      struct sockaddr_storage fromAddress; again ununitialized here.<br>
      <br>
      And if we going through the stack into GroupsockHelper.cpp:411 -
      again switch (from Address.sa_family)<br>
      <br>
      int readSocket(UsageEnvironment& env,<br>
                 int socket, unsigned char* buffer, unsigned bufferSize,<br>
                 struct sockaddr_storage& fromAddress) {<br>
        SOCKLEN_T addressSize = sizeof fromAddress;<br>
        int bytesRead = recvfrom(socket, (char*)buffer, bufferSize, 0,<br>
                     (struct sockaddr*)&fromAddress,<br>
                     &addressSize);<br>
        if (bytesRead < 0) {<br>
          //##### HACK to work around bugs in Linux and Windows:<br>
          int err = env.getErrno();<br>
          if (err == 111 /*ECONNREFUSED (Linux)*/<br>
      #if defined(__WIN32__) || defined(_WIN32)<br>
          // What a piece of crap Windows is.  Sometimes<br>
          // recvfrom() returns -1, but with an 'errno' of 0.<br>
          // This appears not to be a real error; just treat<br>
          // it as if it were a read of zero bytes, and hope<br>
          // we don't have to do anything else to 'reset'<br>
          // this alleged error:<br>
          || err == 0 || err == EWOULDBLOCK<br>
      #else<br>
          || err == EAGAIN<br>
      #endif<br>
          || err == 113 /*EHOSTUNREACH (Linux)*/) { // Why does Linux
      return this for datagram sock?<br>
            switch (fromAddress.ss_family) {<br>
          case AF_INET: {<br>
            ((sockaddr_in&)fromAddress).sin_addr.s_addr = 0;<br>
            break;<br>
          }<br>
              case AF_INET6: {<br>
            for (unsigned i = 0; i < 16; ++i)
      ((sockaddr_in6&)fromAddress).sin6_addr.s6_addr[i] = 0;<br>
            break;<br>
          }<br>
            }<br>
            return 0;<br>
          }<br>
          //##### END HACK<br>
          socketErr(env, "recvfrom() error: ");<br>
        } else if (bytesRead == 0) {<br>
          // "recvfrom()" on a stream socket can return 0 if the remote
      end has closed the connection.  Treat this as an error:<br>
          return -1;<br>
        }<br>
      <br>
        return bytesRead;<br>
      }<br>
      <br>
      here :<br>
      <br>
        switch (fromAddress.ss_family) {<br>
          case AF_INET: {<br>
            ((sockaddr_in&)fromAddress).sin_addr.s_addr = 0;<br>
            break;<br>
          }<br>
              case AF_INET6: {<br>
            for (unsigned i = 0; i < 16; ++i)
      ((sockaddr_in6&)fromAddress).sin6_addr.s6_addr[i] = 0;<br>
            break;<br>
          }<br>
      <br>
      <pre class="moz-signature">-- 
С уважением, Костромин Дмитрий Андреевич,
руководитель подразделения ЗАО НВП "Болид"
г.Орехово-Зуево

</pre>
    </div>
  </body>
</html>