gdiplus: Reimplement metafile loading using gdi32 instead of IPicture. (v2)

Vincent Povirk madewokherd at gmail.com
Thu Aug 18 13:11:06 CDT 2016


> @@ -2220,10 +2157,8 @@ GpStatus WINGDIPAPI GdipGetImageBounds(GpImage *image, GpRectF *srcRect,
>          *srcUnit = UnitPixel;
>      }
>      else{
> -        srcRect->X = srcRect->Y = 0.0;
> -        srcRect->Width = ipicture_pixel_width(image->picture);
> -        srcRect->Height = ipicture_pixel_height(image->picture);
> -        *srcUnit = UnitPixel;
> +        WARN("GpImage with no image data (metafile in wrong state?)\n");
> +        return InvalidParameter;
>      }
>
>      TRACE("returning (%f, %f) (%f, %f) unit type %d\n", srcRect->X, srcRect->Y,

The "metafile in wrong state?" part is wrong, because that would still
have ImageTypeMetafile, and we'd have bounds to return. If this case
ever occurs, it's more likely a use-after-free (we set the type to ~0
when we free images), or a random pointer that doesn't point to a
GpImage.



More information about the wine-devel mailing list