Skip to content

[BZ-4218] Type bug in iovec definition #4218

@jwillemsen

Description

@jwillemsen
Field Value
Bugzilla ID 4218
Reporter Tero.Kaipio
Assigned to DOC Center Support List (internal)
Product ACE
Component ACE Core
Version 6.4.0
Platform / OS IA64 / All
Priority P3
Severity major
Status NEW
Resolution
Created 2016-10-28 07:52:53 -0500

Originally posted by Tero.Kaipio on 2016-10-28 07:52:53 -0500


Type bug in iovec definition.
Checked ACE versions 6.4.0 and 5.6.2.
Both have this so this bug has been around for a while.

Effects any platform that lacks iovec definition and size of ssize_t is larger than u_long.
Effects at least Win64 build where ssize_t is __int64.

File os_include\sys\os_uio.h has a iovec definition
#if defined (ACE_LACKS_IOVEC)
struct iovec
{
/// byte count to read/write
u_long iov_len;
/// data to be read/written
char iov_base;
};
#endif /
ACE_LACKS_IOVEC */

Example where this type bug shows up:

When SSL_read is called in file SSL_SOCK_STREAM.inl
Function
ACE_INLINE ssize_t ACE_SSL_SOCK_Stream::recv_i (void *buf, size_t n, int flags, const ACE_Time_Value *timeout) const
Line
bytes_read = ::SSL_read (this->ssl_, static_cast<char *> (buf), ACE_Utils::truncate_cast (n));

This returns in failure ssize_t -1

In file SSL_SOCK_STREAM.cpp
Function
size_t ACE_SSL_SOCK_Stream::recvv (iovec *io_vec, const ACE_Time_Value *timeout) const

This ssize_t -1 is set to u_long and then returned
io_vec->iov_len = this->recv (io_vec->iov_base, inlen);
return io_vec->iov_len;

The results is that caller gets incorrect value (>4*10^9 instead of -1)

Fix proposal:
Change iovec.iov_len type to ssize_t

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions