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:
function Menu(a,b){mxEventSource.call(this);this.funct=a;this.enabled=null!=b?b:!0}mxUtils.extend(Menu,mxEventSource);Menu.prototype.isEnabled=function(){return this.enabled};Menu.prototype.setEnabled=function(a){this.enabled!=a&&(this.enabled=a,this.fireEvent(new mxEventObject("stateChanged")))};Menu.prototype.execute=function(a,b){this.funct(a,b)};EditorUi.prototype.createMenus=function(){return new Menus(this)};function Toolbar(a,b){this.editorUi=a;this.container=b;this.staticElements=[];this.init();this.gestureHandler=mxUtils.bind(this,function(f){null!=this.editorUi.currentMenu&&mxEvent.getSource(f)!=this.editorUi.currentMenu.div&&this.hideMenu()});mxEvent.addGestureListeners(document,this.gestureHandler)}