Language: JavaScript
Label: vulnerable
CWE: CWE-78 \u2014 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.

Code:
Graph.prototype.fitDiagramToWindow=function(){var b=this.isSelectionEmpty()?mxRectangle.fromRectangle(this.getGraphBounds()):this.getBoundingBox(this.getSelectionCells()),e=this.view.translate,g=this.view.scale;b.x=b.x/g-e.x;b.y=b.y/g-e.y;b.width/=g;b.height/=g;null!=this.backgroundImage&&b.add(new mxRectangle(0,0,this.backgroundImage.width,this.backgroundImage.height));0==b.width||0==b.height?(this.zoomTo(1),ui.resetScrollbars()):(e=Editor.fitWindowBorders,null!=e&&(b.x-=e.x,b.y-=e.y,b.width+=e.width+
e.x,b.height+=e.height+e.y),this.fitWindow(b))};Graph.prototype.fitWindow=function(b,e){e=null!=e?e:10;var g=this.container.clientWidth-e,p=this.container.clientHeight-e;this.zoomTo(Math.floor(20*Math.min(g/b.width,p/b.height))/20);if(mxUtils.hasScrollbars(this.container)){var y=this.view.translate;this.container.scrollLeft=(b.x+y.x)*this.view.scale-Math.max((g-b.width*this.view.scale)/2+e/2,0);this.container.scrollTop=(b.y+y.y)*this.view.scale-Math.max((p-b.height*this.view.scale)/2+e/2,0)}};