Language: JavaScript
Label: safe
CWE: CWE-400 \u2014 Uncontrolled Resource Consumption
The product does not properly control the allocation and maintenance of a limited resource, thereby enabling an actor to influence the amount of resources consumed, eventually leading to the exhaustion of available resources.

Code:
U.prototype.quadTo=function(c,h,q,l){this.originalQuadTo.apply(this.canvas,arguments);this.lastX=q;this.lastY=l};U.prototype.curveTo=function(c,h,q,l,p,v){this.originalCurveTo.apply(this.canvas,arguments);this.lastX=p;this.lastY=v};U.prototype.arcTo=function(c,h,q,l,p,v,w){this.originalArcTo.apply(this.canvas,arguments);this.lastX=v;this.lastY=w};U.prototype.lineTo=function(c,h){if(null!=this.lastX&&null!=this.lastY){var q=function(N){return"number"===typeof N?N?0>N?-1:1:N===N?0:NaN:NaN},l=Math.abs(c-
this.lastX),p=Math.abs(h-this.lastY),v=Math.sqrt(l*l+p*p);if(2>v){this.originalLineTo.apply(this.canvas,arguments);this.lastX=c;this.lastY=h;return}var w=Math.round(v/10),J=this.defaultVariation;5>w&&(w=5,J/=3);var y=q(c-this.lastX)*l/w;q=q(h-this.lastY)*p/w;l/=v;p/=v;for(v=0;v<w;v++){var Y=(Math.random()-.5)*J;this.originalLineTo.call(this.canvas,y*v+this.lastX-Y*p,q*v+this.lastY-Y*l)}this.originalLineTo.call(this.canvas,c,h)}else this.originalLineTo.apply(this.canvas,arguments);this.lastX=c;this.lastY=
h};U.prototype.destroy=function(){this.canvas.lineTo=this.originalLineTo;this.canvas.moveTo=this.originalMoveTo;this.canvas.close=this.originalClose;this.canvas.quadTo=this.originalQuadTo;this.canvas.curveTo=this.originalCurveTo;this.canvas.arcTo=this.originalArcTo};mxShape.prototype.defaultJiggle=1.5;var Za=mxShape.prototype.beforePaint;mxShape.prototype.beforePaint=function(c){Za.apply(this,arguments);null==c.handJiggle&&(c.handJiggle=this.createHandJiggle(c))};var pb=mxShape.prototype.afterPaint;