< Previous by Date Date Index Next by Date >
  Thread Index Next in Thread >

[reSIProcate] Problem using resipfaststream


Hi all,
I encountered an issue using Resiprocate 1.4 (SVN head) using
resipfaststreams (define RESIP_USE_STL_STREAMS is commented).
I obtained an access violation (using TLS, but I think that this is not
important) I suppose because the read buffer size was -1.
In TlsConnection.cxx there are the following two lines:
        int bytesRead = SSL_read(mSsl,buf,count);
        StackLog(<< "SSL_read returned " << bytesRead << " bytes [" <<
Data(Data::Borrow, buf, bytesRead) << "]");
Executing my application SSL_read() returns -1.
I suppose that the access violation is caused by operator << applied to
Data(Data::Borrow, buf, bytesRead), where bytesRead is -1.
I had a look at "size_t DataBuffer::readbuf(char *buf, size_t count)"
and "size_t DataBuffer::writebuf(const char *str, size_t count)" in
Resiprocate\rutil\DataStream.cxx that are used when
RESIP_USE_STL_STREAMS is not defined.
The type of size_t is unsigned int but in readbuf() and writebuf() is
executed the following check:
[...]
   if (count <= 0)
   {
      return 0;
   }
[...]
Actually if buffer size is -1, then count is 4294967295, so the method
doesn't exit and the writebuf() method causes access violation.
Is that right or did I make a mistake?

Thank you in advance.

Best regards,
Dario Bozzali.