Discussion:
[omniORB] Potential bug in omniORB 4.1
Peter S. Housel
2007-03-07 14:37:19 UTC
Permalink
I'm trying to get omniifr working with omniORB 4.1. (It worked fine
with omnORB 4.0.7.) With the IR running, using "omniidl -bifr" to compie
the IDL code located at:

http://corba-omniorb.cvs.sourceforge.net/*checkout*/corba-omniorb/corba-omniorb/Account.idl?revision=1.1.1.1

ends up causing a marshalling exception.

I traced the problem to the following code in
src/lib/omniORB/dynamic/typecode.cc:

case CORBA::tk_enum:
{
// check that <label> is of the correct type
if( !dtc->equivalent(lbl_tc) )
OMNIORB_THROW(BAD_PARAM,
BAD_PARAM_IncompatibleDiscriminatorType,
CORBA::COMPLETED_NO);
CORBA::ULong c;
label >>= c;
lbl_value = c;
break;
}

The discriminator type is tk_enum, and label has a tk_enum typecode too,
but the code here is trying to extract the label into a CORBA::ULong.
Due to the type mismatch, the extract into c fails.

Is this a bug in omniORB 4.1, or in the way omniifr is using
CORBA::create_union_tc()?
--
Peter S. Housel <***@acm.org>
Duncan Grisby
2007-03-08 00:34:58 UTC
Permalink
On Wednesday 7 March, "Peter S. Housel" wrote:

[...]
Post by Peter S. Housel
I traced the problem to the following code in
[...]
Post by Peter S. Housel
The discriminator type is tk_enum, and label has a tk_enum typecode too,
but the code here is trying to extract the label into a CORBA::ULong.
Due to the type mismatch, the extract into c fails.
Is this a bug in omniORB 4.1, or in the way omniifr is using
CORBA::create_union_tc()?
Yes, it is a bug. I've fixed it in CVS.

Thanks for the bug report.

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
Peter Housel
2007-03-08 05:43:37 UTC
Permalink
On 2007-03-07, Duncan Grisb wrote?
Post by Duncan Grisby
Yes, it is a bug. I've fixed it in CVS.
Thanks for the bug report.
Duncan.
Almost... I had to add the following patch before it would work:

--- typecode.cc 07 Mar 2007 20:11:51 -0800 1.40.2.14
+++ typecode.cc 07 Mar 2007 20:41:41 -0800
@@ -6046,6 +6046,7 @@
CORBA::COMPLETED_NO);
CORBA::ULong c;
cdrAnyMemoryStream& ms = label.PR_streamToRead();
+ ms.rewindInputPtr();
c <<= ms;
lbl_value = c;
break;
Duncan Grisby
2007-03-09 21:35:45 UTC
Permalink
Post by Peter Housel
--- typecode.cc 07 Mar 2007 20:11:51 -0800 1.40.2.14
+++ typecode.cc 07 Mar 2007 20:41:41 -0800
@@ -6046,6 +6046,7 @@
CORBA::COMPLETED_NO);
CORBA::ULong c;
cdrAnyMemoryStream& ms = label.PR_streamToRead();
+ ms.rewindInputPtr();
c <<= ms;
lbl_value = c;
break;
Sorry about that. Your addition is actually also wrong, because it isn't
thread safe against two threads using the same any at the same time. The
correct fix creates a wrapper memory stream that has its own set of
index pointers.

Cheers,

Duncan.
--
-- Duncan Grisby --
-- ***@grisby.org --
-- http://www.grisby.org --
Loading...