mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:27:35 +00:00
LibGfx: Don't use unbounded VLA's in FastBoxBlurFilter
These would cause the stack to overflow when LibWeb tried rendering a CSS box-shadow for a large enough element. Use Vector (with *some* inline capacity for smaller images) to avoid this issue. If these heap allocations turn out to be too much work, we can add something like a persistent scratch buffer cache.
This commit is contained in:
parent
4fcb1be734
commit
f9a38fa693
1 changed files with 9 additions and 4 deletions
|
@ -28,10 +28,15 @@ public:
|
|||
|
||||
int div = 2 * radius + 1;
|
||||
|
||||
u8 intermediate_red[width * height];
|
||||
u8 intermediate_green[width * height];
|
||||
u8 intermediate_blue[width * height];
|
||||
u8 intermediate_alpha[width * height];
|
||||
Vector<u8, 1024> intermediate_red;
|
||||
Vector<u8, 1024> intermediate_green;
|
||||
Vector<u8, 1024> intermediate_blue;
|
||||
Vector<u8, 1024> intermediate_alpha;
|
||||
|
||||
intermediate_red.resize(width * height);
|
||||
intermediate_green.resize(width * height);
|
||||
intermediate_blue.resize(width * height);
|
||||
intermediate_alpha.resize(width * height);
|
||||
|
||||
// First pass: vertical
|
||||
for (int y = 0; y < height; ++y) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue