[Spice-devel] [PATCH] Fix marshallers for SpiceMsgPortInit

Frediano Ziglio fziglio at redhat.com
Thu Sep 8 17:59:23 UTC 2016


> > 
> > Protocol states that name is an array of bytes but the marshallers are
> > considering it a pointer to an array of bytes. A client that does not
> > use demarshallers from spice-common will find an incorrect
> > implementation of spice-server SpiceMsgPortInit.
> > 
> > Reported-by: Oliver Gutierrez <ogutierrez at redhat.com>
> > Signed-off-by: Pavel Grunt <pgrunt at redhat.com>
> > Signed-off-by: Victor Toso <victortoso at redhat.com>
> > ---
> >  spice.proto | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/spice.proto b/spice.proto
> > index 0bfc515..08d7152 100644
> > --- a/spice.proto
> > +++ b/spice.proto
> > @@ -1412,7 +1412,7 @@ channel PortChannel : SpicevmcChannel {
> >   server:
> >      message {
> >  	uint32 name_size;
> > -	uint8 *name[name_size] @zero_terminated @marshall @nonnull;
> > +	uint8 name[name_size] @zero_terminated @marshall @nonnull;
> >  	uint8 opened;
> >      } init = 201;
> >      message {
> 
> We had some discussion on IRC.
> 
> Basically this message is changing the protocol format which obviously
> breaks compatibility.
> The "uint8 *name[name_size]" in the protocol means that there is a 4 byte
> offset that points to a "uint8 name[name_size]", the message could be
> something like
> - name_size (4 bytes)
> - offset of name (4 bytes)
> - opened (1 bytes)
> - name (name_size bytes)
> 
> Yes, it's complicated and using just a normal array would avoid the 4
> bytes.
> 

I would add:

We REALLY need documentation for the protocol to avoid future
unwanted sub optimal protocol.

Frediano


More information about the Spice-devel mailing list