LockRect Problem

Erich Hoover ehoover at mines.edu
Mon Mar 12 11:39:26 CDT 2007

On 3/12/07, H. Verbeet <hverbeet at gmail.com> wrote:
> On 12/03/07, Erich Hoover <ehoover at mines.edu> wrote:
> > I think that the allocated memory should be the size of the resource
> > multiplied by 4 (instead of adding 4).
> What makes you think that?

Just that (pLockedRect->Pitch * pRect->top) with pRect->top = This->
currentDesc.Height would return a value 4x that of This->resource.size.

IIRC the +4 there is for dodgy applications reading just past the end
> of the surface, but that line could do with a comment in either case.
> > I've dug around a bit to see if This->resource.size was just allocated
> > incorrectly but that does not appear the case.  So, if someone could
> confirm
> > or deny that this is a typo problem then I'd really appreciate it.
> >
> Could you look into my comment in bugzilla? I'll probably write a test
> for that either way, but it's probably quite a bit faster for you to
> check if what I posted there makes any difference.

Dividing pRect->top by 4 seems to solve the problem.  Allocating 4 times as
much memory also solves the problem (no apparent visual difference), but
your explanation in bugzilla makes sense.  Will you be taking care of this,
or should I write up a patch with the divide by 4 and a bounds check?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.winehq.org/pipermail/wine-devel/attachments/20070312/c1567d96/attachment.html

More information about the wine-devel mailing list