Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Use of TAO_FixedSeq_Var_T when ptr_ is 0 causes seg fault

22 views
Skip to first unread message

mikem

unread,
May 15, 2012, 6:41:19 PM5/15/12
to
TAO VERSION: 2.1.1
ACE VERSION: 6.1.1

HOST MACHINE and OPERATING SYSTEM:
Red Hat Enterprise Linux Server release 5.7

TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
COMPILER NAME AND VERSION (AND PATCHLEVEL): (as above)
g++ (GCC) 4.1.2
THE $ACE_ROOT/ace/config.h FILE [if you use a link to a platform-
specific file, simply state which one]:
#include "ace/config-linux.h"

THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE [if you use
a link to a platform-specific file, simply state which one (unless
this isn't used in this case, e.g., with Microsoft Visual C++)]:
include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU

CONTENTS OF $ACE_ROOT/bin/MakeProjectCreator/config/default.features
(used by MPC when you generate your own makefiles):

AREA/CLASS/EXAMPLE AFFECTED:
IDL generated Sequence _var types (specifically TAO_FixedSeq_Var_T)

DOES THE PROBLEM AFFECT:
COMPILATION? YES
LINKING? NO
EXECUTION YES
OTHER NO
My application Segmentation fault (core dumped)

SYNOPSIS:
Not able to check if underlying ptr_ is 0 for TAO_FixedSeq_Var_T and
so calling member functions when ptr_=0 causes seg fault.

DESCRIPTION:
// Test.idl
module Test
{
typedef sequence<long> LongList;
};

//client.cpp
Test::LongList_var longList(0);
std::cerr << "longList->length()=" << longList->length() << std::endl;

> client -k file://server.ior
Segmentation fault (core dumped)

REPEAT BY:
I used the TAO/tests/Hello with the idl and client.cpp changes I
show.

SAMPLE FIX/WORKAROUND:
Not sure what to do. Porting an existing application to use TAO
where Sequence_var’s are first checked for null before accessing
sequence methods. If the idl sequence elements are variable-length
(not fixed), then TAO_VarSeq_Var_T allows check-for null using:
operator T *& (). But fixed-length sequences do not provide the same
operator.

thanks for any help you can give,
-mike

Adam Mitz

unread,
May 16, 2012, 10:47:24 AM5/16/12
to michael....@baesystems.com, tao-...@list.isis.vanderbilt.edu
Hi Mike,

How about using the ptr() member function of the var?

Thanks,
Adam Mitz
Senior Software Engineer
Object Computing, Inc.

McKnerney, Michael D (US SSA)

unread,
May 16, 2012, 12:56:37 PM5/16/12
to tao-...@list.isis.vanderbilt.edu
Hi Adam,

Thanks for your response.

I missed the TAO-specific ptr() for var's.

(I just need to add ptr() calls in allot of places)

I wonder why operator T *& () is not supported on TAO_FixedSeq_Var_T ?

Btw- I see that the v1.2 mapping spec says (4.11.1) "Conversion of a null T_var to a T*& is also allowed so as to be compatible with earlier versions of this specification." But I guess that does not mean an "implicit conversion" shall be required ?

thanks again,
-mike

Adam Mitz

unread,
May 16, 2012, 1:38:28 PM5/16/12
to tao-...@list.isis.vanderbilt.edu
Hi Mike,

On 5/16/2012 11:56 AM, McKnerney, Michael D (US SSA) wrote:
> Hi Adam,
>
> Thanks for your response.
>
> I missed the TAO-specific ptr() for var's.
>
> (I just need to add ptr() calls in allot of places)
>
> I wonder why operator T *& () is not supported on TAO_FixedSeq_Var_T ?
>
> Btw- I see that the v1.2 mapping spec says (4.11.1) "Conversion of a null T_var to a T*& is also allowed so as to be compatible with earlier versions of this specification." But I guess that does not mean an "implicit conversion" shall be required ?
>

My reading of the spec is that when it talks about "conversion" it
really is requiring a C++ user-defined conversion operator.

I agree that something is wrong with TAO's implementation in this area.
All sequences (even bounded) are considered variable-length for the sake
of parameter passing and "*_var" rules. This is described in the 2nd
pgh of 4.11. It's also evident from the fact that Table 4.5 in the
Bolton book has just one row for "sequence."

Please create a Bugzilla entry with the details. It may help to also
attach a small test that doesn't compile unless TAO is compliant. Then
you can decide if you'd like to create a patch yourself or fund one of
the commercial support companies (such as my employer) to work on it.
0 new messages