[PATCH] ole32: handle length=0 in save datacache

Marcus Meissner marcus at jet.franken.de
Sun Nov 5 16:09:31 CST 2017


On Fri, Nov 03, 2017 at 07:22:31PM +0800, Dmitry Timoshkov wrote:
> Marcus Meissner <marcus at jet.franken.de> wrote:
> 
> > The ole2 test crashes for me, reason is that length is 0
> > and we use length-1 for accessing whats returned.
> ...
> > +        if (!length)
> > +            return DV_E_CLIPFORMAT;
> 
> The test intentionally creates the storage streams with length
> field set to 0, and as the tests show this is not an error.
> So the fix should be probably different.

That was a can of worms.

- GetClipboardFormatName returns charactercount without counting leading
  \0, write_clipformat did not take it into account.
- GetClipboardFormatName(fmt,NULL,0) always returns 0 and not the needed characters.
  write_clipformat did not take it into account.
- OLE format stores the clipboard format name with \0 inside
- length 0 in the stream means "no clipboard format"

  https://msdn.microsoft.com/en-us/library/dd942254.aspx

I sent in another patch.

Ciao, Marcus



More information about the wine-devel mailing list