mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1223740 - enforce max surface size for DrawTargetSkia. r=bas
This commit is contained in:
parent
939265df10
commit
68e374cb22
22
dom/canvas/crashtests/1223740-1.html
Normal file
22
dom/canvas/crashtests/1223740-1.html
Normal file
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<script>
|
||||
|
||||
function boom() {
|
||||
var canvas = document.createElement('canvas');
|
||||
var ctx = canvas.getContext('2d');
|
||||
ctx.shadowColor = "green";
|
||||
ctx.rotate(0.9923);
|
||||
ctx.transform(6, 0.13807760834183488, 256, -0.39007851257689263, 0.5767177072299453, 64);
|
||||
ctx.transform(0.61, 0.08697788582345888, 6, 6, 64, 128);
|
||||
ctx.scale(0.36690500480283633, 6);
|
||||
ctx.shadowOffsetY = -1.7976931348623157e+308;
|
||||
ctx.fillText("A",32,0.848476537933684);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body onload="boom();"></body>
|
||||
</html>
|
@ -23,5 +23,6 @@ load 1099143-1.html
|
||||
load 1161277-1.html
|
||||
load 1183363.html
|
||||
load 1190705.html
|
||||
load 1223740-1.html
|
||||
load 1225381-1.html
|
||||
load texImage2D.html
|
||||
|
@ -830,6 +830,10 @@ DrawTargetSkia::CopySurface(SourceSurface *aSurface,
|
||||
bool
|
||||
DrawTargetSkia::Init(const IntSize &aSize, SurfaceFormat aFormat)
|
||||
{
|
||||
if (size_t(std::max(aSize.width, aSize.height)) > GetMaxSurfaceSize()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SkAlphaType alphaType = (aFormat == SurfaceFormat::B8G8R8X8) ?
|
||||
kOpaque_SkAlphaType : kPremul_SkAlphaType;
|
||||
|
||||
@ -863,6 +867,10 @@ DrawTargetSkia::InitWithGrContext(GrContext* aGrContext,
|
||||
{
|
||||
MOZ_ASSERT(aGrContext, "null GrContext");
|
||||
|
||||
if (size_t(std::max(aSize.width, aSize.height)) > GetMaxSurfaceSize()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mGrContext = aGrContext;
|
||||
mSize = aSize;
|
||||
mFormat = aFormat;
|
||||
|
@ -117,6 +117,11 @@ public:
|
||||
SurfaceFormat aFormat) override;
|
||||
#endif
|
||||
|
||||
// Skia assumes that texture sizes fit in 16-bit signed integers.
|
||||
static size_t GetMaxSurfaceSize() {
|
||||
return 32767;
|
||||
}
|
||||
|
||||
operator std::string() const {
|
||||
std::stringstream stream;
|
||||
stream << "DrawTargetSkia(" << this << ")";
|
||||
|
@ -507,7 +507,7 @@ Factory::GetMaxSurfaceSize(BackendType aType)
|
||||
return DrawTargetCG::GetMaxSurfaceSize();
|
||||
#endif
|
||||
case BackendType::SKIA:
|
||||
return INT_MAX;
|
||||
return DrawTargetSkia::GetMaxSurfaceSize();
|
||||
#ifdef WIN32
|
||||
case BackendType::DIRECT2D:
|
||||
return DrawTargetD2D::GetMaxSurfaceSize();
|
||||
|
Loading…
Reference in New Issue
Block a user