# In handle_chunking: change to distinguish a null value tag from # a chunk size tag (the latter must be positive). # In read_untyped_value and readChunkSizeTag: changes for correctness (to # ensure that chunk_end_pos is set to -1 if we are not within a chunk) and # for clarity. diff -r -u --ignore-all-space 2.3.0zip/JacORB/src/org/jacorb/orb/CDRInputStream.java 2.3.0cvs/JacORB/src/org/jacorb/orb/CDRInputStream.java --- src/org/jacorb/orb/CDRInputStream.java 2007-05-28 15:53:54.000000000 -0400 +++ src/org/jacorb/orb/CDRInputStream.java 2007-05-28 16:12:28.000000000 -0400 @@ -50,7 +50,7 @@ * Read CDR encoded data * * @author Gerald Brose, FU Berlin - * $Id: CDRInputStream.java,v 1.114 2007/01/08 12:18:45 alphonse.bendt Exp $ + * $Id: CDRInputStream.java,v 1.115 2007/04/27 19:14:06 francisco Exp $ */ public class CDRInputStream @@ -466,7 +466,7 @@ // tag is an end tag - if ( ! (-tag <= valueNestingLevel)) + if (-tag > valueNestingLevel) { throw new INTERNAL ( @@ -484,17 +484,17 @@ handle_chunking(); } } - else if (tag < 0x7fffff00) + else if (tag > 0 && tag < 0x7fffff00) { // tag is the chunk size tag of another chunk chunk_end_pos = pos + tag; } - else // (tag >= 0x7fffff00) + else // (tag == 0 || tag >= 0x7fffff00) { - // tag is the value tag of a nested value + // tag is the null value tag or the value tag of a nested value - pos = saved_pos; // "unread" the value tag + pos = saved_pos; // "unread" the tag index = saved_index; } } @@ -2883,8 +2883,7 @@ if (chunkedValue || valueNestingLevel > 0) { valueNestingLevel++; - int chunk_size_tag = readChunkSizeTag(); - chunk_end_pos = pos + chunk_size_tag; + readChunkSizeTag(); } for (int i = 0; i < repository_ids.length; i++) @@ -3087,7 +3086,7 @@ * special handling if there's no chunk size * in the stream. */ - private int readChunkSizeTag() + private void readChunkSizeTag() { int savedPos = pos; int savedIndex = index; @@ -3095,14 +3094,16 @@ if (!sunInteropFix || chunk_size_tag > 0 && chunk_size_tag < MAX_BLOCK_SIZE) { - // looks like the correct chunk size - return chunk_size_tag; + // valid chunk size: set the ending position of the chunk + chunk_end_pos = pos + chunk_size_tag; } - - // reset buffer + else + { + // reset buffer and remember that we're not within a chunk pos = savedPos; index = savedIndex; - return MAX_BLOCK_SIZE; + chunk_end_pos = -1; + } } /**