[omniORB] read-only MemBufferedStream. a bug?
Walt Yao
Walt.Yao@cl.cam.ac.uk
Mon, 10 May 1999 16:31:00 +0100
hi omniOrbers,
I am aware a few people have asked questions on how to serialise CORBA data
using the omniORB's way, and David has given an excellent solution using
MemBufferedStream. (search on subject title Re: [omniORB] Need to save Any to
void* - serialise it?). However, having tried using MemBufferedStream, I was
rather surprised that I failed to bring my serialised data back from the disk.
omniORB raises MARSHAL exception in every case.
I therefore began my investigation on this problem by looking into omni's source code. It turns out that if you construct a read-only MemBufferedStream object by giving a preallocated piece of memory to the constructor, the constructor will set both in and out markers to the beginning of the memory buffer you passed in.
During subsequent read access from MemBufferedStream (which I suspect everyone would want to do this. that's the whole point of constructing a read-only buffered stream), a check against memory overrun will be done. Since the check is based on comparing pd_in_mkr and pd_out_mkr, this will always fail since pd_out_mkr is set to the beginning of the buffer. Upon (falsely) detecting buffer overrun, an exception is thrown.
I have tried to manually set pd_out_mkr in gdb, and it turned out to be working fine. I wonder if this is my fault due to wrong usage of MemBufferedStream, or if this is a bug in omniORB? Any comment will be highly appreciated. Thanks.
// Walt