Bug 601131 - Hang with feTurbulence with huge numOctaves. r=roc

This commit is contained in:
Robert Longson 2013-06-24 10:42:22 +01:00
parent e438b2ce3d
commit fd050c27d1

View File

@ -23,6 +23,8 @@ static const unsigned short SVG_STITCHTYPE_UNKNOWN = 0;
static const unsigned short SVG_STITCHTYPE_STITCH = 1;
static const unsigned short SVG_STITCHTYPE_NOSTITCH = 2;
static const int32_t MAX_OCTAVES = 10;
JSObject*
SVGFETurbulenceElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aScope)
{
@ -137,7 +139,7 @@ SVGFETurbulenceElement::Filter(nsSVGFilterInstance* instance,
float fX = mNumberPairAttributes[BASE_FREQ].GetAnimValue(nsSVGNumberPair::eFirst);
float fY = mNumberPairAttributes[BASE_FREQ].GetAnimValue(nsSVGNumberPair::eSecond);
float seed = mNumberAttributes[OCTAVES].GetAnimValue();
int32_t octaves = mIntegerAttributes[OCTAVES].GetAnimValue();
int32_t octaves = std::min(mIntegerAttributes[OCTAVES].GetAnimValue(), MAX_OCTAVES);
uint16_t type = mEnumAttributes[TYPE].GetAnimValue();
uint16_t stitch = mEnumAttributes[STITCHTILES].GetAnimValue();