Limit morphology radius to 100 pixels
This limit is arbitrary, but hopefully prevents pathological (or malicious) SVG content from consuming huge amounts of CPU/GPU time, without impacting any legitimate uses of feMorphology. (Typical usage has a much smaller radius). Bug: chromium:1123035 Change-Id: I4405bc595128e9a6287eb5efa1be14621baa3a00 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315219 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
1ee21cdfb6
commit
6763a713f9
@ -637,7 +637,9 @@ sk_sp<SkSpecialImage> SkMorphologyImageFilterImpl::onFilterImage(const Context&
|
||||
int height = SkScalarRoundToInt(radius.height());
|
||||
|
||||
// Width (or height) must fit in a signed 32-bit int to avoid UBSAN issues (crbug.com/1018190)
|
||||
constexpr int kMaxRadius = (std::numeric_limits<int>::max() - 1) / 2;
|
||||
// Further, we limit the radius to something much smaller, to avoid extremely slow draw calls:
|
||||
// (crbug.com/1123035):
|
||||
constexpr int kMaxRadius = 100; // (std::numeric_limits<int>::max() - 1) / 2;
|
||||
|
||||
if (width < 0 || height < 0 || width > kMaxRadius || height > kMaxRadius) {
|
||||
return nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user