[jboss-jira] [JBoss JIRA] (JGRP-2285) ObjectMessage: handle objects with incorrect size
Bela Ban (JIRA)
issues at jboss.org
Mon Sep 10 03:31:00 EDT 2018
Bela Ban created JGRP-2285:
------------------------------
Summary: ObjectMessage: handle objects with incorrect size
Key: JGRP-2285
URL: https://issues.jboss.org/browse/JGRP-2285
Project: JGroups
Issue Type: Enhancement
Reporter: Bela Ban
Assignee: Bela Ban
Fix For: 5.0
An ObjectMessage accepts objects of type SizeStreamable. When such an object has an incorrect serializableSize() method, the following can happen:
* Say the serialized size is 1000, but serializedSize() returns 1200
* When the ObjectMessage is serialized, a length of 1200 is written, but then only 1000 bytes are serialized onto the output stream
* On the receiving side, length=1200 is read and a byte array of 1200 is created
* DataInput.readFully() reads 1000 bytes, but then reaches the eof of the stream, trying to read an additional 200 bytes
* An exception is thrown and the reading of the message fails
If we caught the exception, things would work, however this would mask other errors in the object serialization/deserialization code.
If the serilization code was able to mark the position of the output stream, then we could write the *actual number of bytes written* (especially if it differs from serializedSize()); however, DataOutput doesn't give us this option!
Investigate whether simply catching (and ignoring) the EOFException would work.
--
This message was sent by Atlassian JIRA
(v7.5.0#75005)
More information about the jboss-jira
mailing list