JDK-5034649 : indirecting typecodes is wrong
  • Type: Bug
  • Component: other-libs
  • Sub-Component: corba:orb
  • Affected Version: 5.0
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2004-04-20
  • Updated: 2004-06-30
  • Resolved: 2004-12-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.2_07Fixed
Related Reports
Relates :  
Description
This is also a bug in 1.4.x also, but doesn't seem to affect us so badly there. The issue is to do with indirecting typecodes. The JDK appears to be calculating 
indirections based on alignment rather than on the actual start of a type 
code. In the atttached trace that the JDK sent us we see this:

   880: 0000 0184 0000 0000 0000 0050 524d 493a   ...........PRMI:
   896: 5b4c 7765 626c 6f67 6963 2e6d 616e 6167   [Lweblogic.manag
   912: 656d 656e 742e 5765 624c 6f67 6963 4f62   ement.WebLogicOb
   928: 6a65 6374 4e61 6d65 3b3a 3634 3838 4331   jectName;:6488C1
   944: 4137 3446 3946 4139 4541 3a36 3630 3736   A74F9FA9EA:66076
   960: 4133 4532 4344 4531 4242 3100 0000 0009   A3E2CDE1BB1.....
   976: 5365 7175 656e 6365 0000 0000 0000 0013   Sequence........
   992: 0000 0114 0000 0000 0000 001d 0000 0102   ................
  1008: 0000 0000 0000 004d 524d 493a 7765 626c   .......MRMI:webl

998 is the start of  a sequence typecode: 0000 0013
the next 4 bytes are the encapsulation length then one byte endian followed
by three bytes padding and then the start of the element type 
typecode:  0000 001d
which is a valuetype. Further on in the buffer we see this:

   224: 6500 0000 0000 0008 0000 0000 0000 0007   e...............
   240: 7061 7265 6e74 0000 ffff ffff ffff fef9   parent..........

which is an indirected typecode to 997 in the buffer. However 997 is not 
the start of a typecode it is the start of the alignment before the 
typecode. The indirection should actually be to 1000 where the typecode 
actually starts. We have had this bug in our code in the past and usually 
comes from calculating the indirection offset before aligning rather than 
after aligning. I am hoping Harold or someone can find the problem with us 
cooking up a testcase since its somewhat hard to reproduce.

Here is the buffer trace:

<Apr 16, 2004 12:08:37 PM PDT> <Debug> <IIOP> <BEA-002031> <Marshal: received [i
iop] from 192.168.11.147:2495(2495) on Default_iiop:iiop(iiop):192.168.11.147:88
01:null:-1
    0: 4749 4f50 0102 0200 0000 03f4 0000 0015   GIOP............
   16: 0300 0000 0000 0002 0000 0080 0042 4541   .............BEA
   32: 0801 0300 0000 000c 6164 6d69 6e53 6572   ........adminSer
   48: 7665 7200 0000 0000 0000 003b 524d 493a   ver........;RMI:
   64: 7765 626c 6f67 6963 2e6d 616e 6167 656d   weblogic.managem
   80: 656e 742e 5265 6d6f 7465 4d42 6561 6e53   ent.RemoteMBeanS
   96: 6572 7665 723a 3030 3030 3030 3030 3030   erver:0000000000
  112: 3030 3030 3030 0000 0000 0004 3238 3800   000000......288.
  128: 0000 0001 4245 4129 0000 0010 0000 0000   ....BEA)........
  144: 0000 0000 4815 ae96 8016 52ba 0000 000d   ....H.....R.....
  160: 7365 7441 7474 7269 6275 7465 0000 0003   setAttribute....
  176: 0000 0003 0000 0011 0000 0002 0002 0001   ................
  192: 0000 0001 0000 000c 0000 0000 0001 0020   ...............
  208: 0001 0100 4e45 4f00 0000 0002 0014 0020   ....NEO........
  224: 7fff ff0a 0000 004d 524d 493a 7765 626c   .......MRMI:webl
  240: 6f67 6963 2e6d 616e 6167 656d 656e 742e   ogic.management.
  256: 5765 624c 6f67 6963 4f62 6a65 6374 4e61   WebLogicObjectNa
  272: 6d65 3a36 3438 3843 3141 3734 4639 4641   me:6488C1A74F9FA
  288: 3945 413a 3636 3037 3641 3345 3243 4445   9EA:66076A3E2CDE
  304: 3142 4231 0036 3037 0000 0003 0101 0045   1BB1.607.......E
  320: 7fff ff0a 0000 0023 4944 4c3a 6f6d 672e   .......#IDL:omg.
  336: 6f72 672f 434f 5242 412f 5753 7472 696e   org/CORBA/WStrin
  352: 6756 616c 7565 3a31 2e30 0053 0000 005c   gValue:1.0.S...  368: 0000 0058 006d 0079 0064 006f 006d 0061   ...X.m.y.d.o.m.a
  384: 0069 006e 003a 004e 0061 006d 0065 003d   .i.n.:.N.a.m.e.=
  400: 0057 0054 0043 0053 0065 0072 0076 0065   .W.T.C.S.e.r.v.e
  416: 0072 0043 006c 0069 0065 006e 0074 002c   .r.C.l.i.e.n.t.,
  432: 0054 0079 0070 0065 003d 0057 0054 0043   .T.y.p.e.=.W.T.C
  448: 0053 0065 0072 0076 0065 0072 ffff fffe   .S.e.r.v.e.r....
  464: 0000 0007 95e8 ed26 0100 0072 7fff ff0a   .......&...r....
  480: 0000 004d 524d 493a 7765 626c 6f67 6963   ...MRMI:weblogic
  496: 2e6d 616e 6167 656d 656e 742e 5765 624c   .management.WebL
  512: 6f67 6963 4f62 6a65 6374 4e61 6d65 3a36   ogicObjectName:6
  528: 3438 3843 3141 3734 4639 4641 3945 413a   488C1A74F9FA9EA:
  544: 3636 3037 3641 3345 3243 4445 3142 4231   66076A3E2CDE1BB1
  560: 0036 3037 0000 0003 0101 0045 7fff ff0a   .607.......E....
  576: 0000 0023 4944 4c3a 6f6d 672e 6f72 672f   ...#IDL:omg.org/
  592: 434f 5242 412f 5753 7472 696e 6756 616c   CORBA/WStringVal
  608: 7565 3a31 2e30 0053 0000 0048 0000 0044   ue:1.0.S...H...D
  624: 006d 0079 0064 006f 006d 0061 0069 006e   .m.y.d.o.m.a.i.n
  640: 003a 004e 0061 006d 0065 003d 006d 0079   .:.N.a.m.e.=.m.y
  656: 0064 006f 006d 0061 0069 006e 002c 0054   .d.o.m.a.i.n.,.T
  672: 0079 0070 0065 003d 0044 006f 006d 0061   .y.p.e.=.D.o.m.a
  688: 0069 006e ffff fffd 0000 000c 0000 0000   .i.n............
  704: 0100 006e 0000 0000 ffff ffff 7fff ff02   ...n............
  720: 0000 0055 524d 493a 7765 626c 6f67 6963   ...URMI:weblogic
  736: 2e6d 616e 6167 656d 656e 742e 696e 7465   .management.inte
  752: 726e 616c 2e57 6562 4c6f 6769 6341 7474   rnal.WebLogicAtt
  768: 7269 6275 7465 3a30 3444 3539 4133 3336   ribute:04D59A336
  784: 3835 3141 3130 383a 3033 3031 3945 3537   851A108:03019E57
  800: 3545 3442 3637 3038 0000 0000 7fff ff02   5E4B6708........
  816: 0000 0023 4944 4c3a 6f6d 672e 6f72 672f   ...#IDL:omg.org/
  832: 434f 5242 412f 5753 7472 696e 6756 616c   CORBA/WStringVal
  848: 7565 3a31 2e30 0000 0000 000e 0054 0061   ue:1.0.......T.a
  864: 0072 0067 0065 0074 0073 0000 0000 001e   .r.g.e.t.s......
  880: 0000 0184 0000 0000 0000 0050 524d 493a   ...........PRMI:
  896: 5b4c 7765 626c 6f67 6963 2e6d 616e 6167   [Lweblogic.manag
  912: 656d 656e 742e 5765 624c 6f67 6963 4f62   ement.WebLogicOb
  928: 6a65 6374 4e61 6d65 3b3a 3634 3838 4331   jectName;:6488C1
  944: 4137 3446 3946 4139 4541 3a36 3630 3736   A74F9FA9EA:66076
  960: 4133 4532 4344 4531 4242 3100 0000 0009   A3E2CDE1BB1.....
  976: 5365 7175 656e 6365 0000 0000 0000 0013   Sequence........
  992: 0000 0114 0000 0000 0000 001d 0000 0102   ................
 1008: 0000 0000 0000 004d 524d 493a 7765 626c   .......MRMI:webl
>
<Apr 16, 2004 12:08:37 PM PDT> <Debug> <IIOP> <BEA-002030> <Transport: received
REQUEST message>
<Apr 16, 2004 12:08:37 PM PDT> <Debug> <IIOP> <BEA-002030> <Transport: collected
 fragment 1 for request 21>
<Apr 16, 2004 12:08:37 PM PDT> <Debug> <IIOP> <BEA-002031> <Marshal: received [i
iop] from 192.168.11.147:2495(2495) on Default_iiop:iiop(iiop):192.168.11.147:88
01:null:-1
    0: 4749 4f50 0102 0007 0000 0330 0000 0015   GIOP.......0....
   16: 6f67 6963 2e6d 616e 6167 656d 656e 742e   ogic.management.
   32: 5765 624c 6f67 6963 4f62 6a65 6374 4e61   WebLogicObjectNa
   48: 6d65 3a36 3438 3843 3141 3734 4639 4641   me:6488C1A74F9FA
   64: 3945 413a 3636 3037 3641 3345 3243 4445   9EA:66076A3E2CDE
   80: 3142 4231 0000 0000 0000 0027 7765 626c   1BB1.......'webl
   96: 6f67 6963 2e6d 616e 6167 656d 656e 742e   ogic.management.
  112: 5765 624c 6f67 6963 4f62 6a65 6374 4e61   WebLogicObjectNa
  128: 6d65 0000 0001 0000 0000 0000 0000 0005   me..............
  144: 0000 0009 6861 7368 436f 6465 0000 0000   ....hashCode....
  160: 0000 0003 0000 0000 0000 0008 6973 4164   ............isAd
  176: 6d69 6e00 0000 0008 0000 0000 0000 0009   min.............
  192: 6973 436f 6e66 6967 0000 0000 0000 0008   isConfig........
  208: 0000 0000 0000 000a 6973 5275 6e74 696d   ........isRuntim
  224: 6500 0000 0000 0008 0000 0000 0000 0007   e...............
  240: 7061 7265 6e74 0000 ffff ffff ffff fef9   parent..........
  256: 0000 0000 0000 0000 7fff ff02 0000 0050   ...............P
  272: 524d 493a 5b4c 7765 626c 6f67 6963 2e6d   RMI:[Lweblogic.m
  288: 616e 6167 656d 656e 742e 5765 624c 6f67   anagement.WebLog
  304: 6963 4f62 6a65 6374 4e61 6d65 3b3a 3634   icObjectName;:64
  320: 3838 4331 4137 3446 3946 4139 4541 3a36   88C1A74F9FA9EA:6
  336: 3630 3736 4133 4532 4344 4531 4242 3100   6076A3E2CDE1BB1.
  352: 0000 0001 7fff ff0a 0000 004d 524d 493a   ...........MRMI:
  368: 7765 626c 6f67 6963 2e6d 616e 6167 656d   weblogic.managem
  384: 656e 742e 5765 624c 6f67 6963 4f62 6a65   ent.WebLogicObje
  400: 6374 4e61 6d65 3a36 3438 3843 3141 3734   ctName:6488C1A74
  416: 4639 4641 3945 413a 3636 3037 3641 3345   F9FA9EA:66076A3E
  432: 3243 4445 3142 4231 003d 0057 0000 0003   2CDE1BB1.=.W....
  448: 0101 0065 7fff ff0a 0000 0023 4944 4c3a   ...e.......#IDL:
  464: 6f6d 672e 6f72 672f 434f 5242 412f 5753   omg.org/CORBA/WS
  480: 7472 696e 6756 616c 7565 3a31 2e30 0063   tringValue:1.0.c
  496: 0000 0048 0000 0044 006d 0079 0064 006f   ...H...D.m.y.d.o
  512: 006d 0061 0069 006e 003a 004e 0061 006d   .m.a.i.n.:.N.a.m
  528: 0065 003d 006d 0079 0073 0065 0072 0076   .e.=.m.y.s.e.r.v
  544: 0065 0072 002c 0054 0079 0070 0065 003d   .e.r.,.T.y.p.e.=
  560: 0053 0065 0072 0076 0065 0072 ffff fffe   .S.e.r.v.e.r....
  576: 0000 0007 0000 0000 0100 002e 7fff ff0a   ................
  592: 0000 004d 524d 493a 7765 626c 6f67 6963   ...MRMI:weblogic
  608: 2e6d 616e 6167 656d 656e 742e 5765 624c   .management.WebL
  624: 6f67 6963 4f62 6a65 6374 4e61 6d65 3a36   ogicObjectName:6
  640: 3438 3843 3141 3734 4639 4641 3945 413a   488C1A74F9FA9EA:
  656: 3636 3037 3641 3345 3243 4445 3142 4231   66076A3E2CDE1BB1
  672: 0079 0070 0000 0003 0101 006f 7fff ff0a   .y.p.......o....
  688: 0000 0023 4944 4c3a 6f6d 672e 6f72 672f   ...#IDL:omg.org/
  704: 434f 5242 412f 5753 7472 696e 6756 616c   CORBA/WStringVal
  720: 7565 3a31 2e30 003a 0000 0048 0000 0044   ue:1.0.:...H...D
  736: 006d 0079 0064 006f 006d 0061 0069 006e   .m.y.d.o.m.a.i.n
  752: 003a 004e 0061 006d 0065 003d 006d 0079   .:.N.a.m.e.=.m.y
  768: 0064 006f 006d 0061 0069 006e 002c 0054   .d.o.m.a.i.n.,.T
  784: 0079 0070 0065 003d 0044 006f 006d 0061   .y.p.e.=.D.o.m.a
  800: 0069 006e ffff fffd 0000 000c 0000 0000   .i.n............
  816: 0100 0023 0000 0000 ffff ffff             ...#........
>

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-rc FIXED IN: tiger-rc INTEGRATED IN: tiger-b59 tiger-rc
03-08-2004

EVALUATION This problem is due to an error in computing the buffer position in the ORB TypeCode implementation (see impl.corba.TypeCodeImpl). The code is computing the position and then reading or writing the TypeCode kind. This causes the ORB to correctly handle recursive TypeCodes while not sending an interoperable representation of the TypeCode in the GIOP message. Both read_value and write_value need to be modified to first read or write the kind, then get the offset and adjust the offset for the length (4 byte) of the long.
03-08-2004