1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:38:10 +00:00

LibWeb: Limit the maximum size of <canvas> bitmap buffers

We will no longer create bitmap buffers for canvases that exceed a
total area of (16384 * 16384) pixels. This matches what some other
browser do.

Thanks to @itamar8910 for finding this! :^)
This commit is contained in:
Andreas Kling 2020-04-15 12:12:19 +02:00
parent 228ace854c
commit 3f698db85d
5 changed files with 49 additions and 18 deletions

View file

@ -126,7 +126,12 @@ OwnPtr<Gfx::Painter> CanvasRenderingContext2D::painter()
if (!m_element)
return nullptr;
return make<Gfx::Painter>(m_element->ensure_bitmap());
if (!m_element->bitmap()) {
if (!m_element->create_bitmap())
return nullptr;
}
return make<Gfx::Painter>(*m_element->bitmap());
}
}