Language: JavaScript
Label: vulnerable
CWE: CWE-79 \u2014 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.

Code:
EditorUi.prototype.patchPages=function(b,f,m,d,u){var v={},E=[],F={},L={},N={},H={};if(null!=d&&null!=d[EditorUi.DIFF_UPDATE])for(var R in d[EditorUi.DIFF_UPDATE])v[R]=d[EditorUi.DIFF_UPDATE][R];if(null!=f[EditorUi.DIFF_REMOVE])for(d=0;d<f[EditorUi.DIFF_REMOVE].length;d++)L[f[EditorUi.DIFF_REMOVE][d]]=!0;if(null!=f[EditorUi.DIFF_INSERT])for(d=0;d<f[EditorUi.DIFF_INSERT].length;d++)F[f[EditorUi.DIFF_INSERT][d].previous]=f[EditorUi.DIFF_INSERT][d];if(null!=f[EditorUi.DIFF_UPDATE])for(R in f[EditorUi.DIFF_UPDATE])d=
f[EditorUi.DIFF_UPDATE][R],null!=d.previous&&(H[d.previous]=R);if(null!=b){var J="";for(d=0;d<b.length;d++){var c=b[d].getId();N[c]=b[d];null!=H[J]||L[c]||null!=f[EditorUi.DIFF_UPDATE]&&null!=f[EditorUi.DIFF_UPDATE][c]&&null!=f[EditorUi.DIFF_UPDATE][c].previous||(H[J]=c);J=c}}var e={},g=mxUtils.bind(this,function(p){var t=null!=p?p.getId():"";if(null!=p&&!e[t]){e[t]=!0;E.push(p);var x=null!=f[EditorUi.DIFF_UPDATE]?f[EditorUi.DIFF_UPDATE][t]:null;null!=x&&(this.updatePageRoot(p),null!=x.name&&p.setName(x.name),
null!=x.view&&this.patchViewState(p,x.view),null!=x.cells&&this.patchPage(p,x.cells,v[p.getId()],u),!m||null==x.cells&&null==x.view||(p.needsUpdate=!0))}p=H[t];null!=p&&(delete H[t],g(N[p]));p=F[t];null!=p&&(delete F[t],q(p))}),q=mxUtils.bind(this,function(p){p=mxUtils.parseXml(p.data).documentElement;p=new DiagramPage(p);this.updatePageRoot(p);var t=N[p.getId()];null==t?g(p):(this.patchPage(t,this.diffPages([t],[p]),v[t.getId()],u),m&&(t.needsUpdate=!0))});g();for(R in H)g(N[H[R]]),delete H[R];for(R in F)q(F[R]),
delete F[R];return E};EditorUi.prototype.patchViewState=function(b,f){if(null!=b.viewState&&null!=f){b==this.currentPage&&(b.viewState=this.editor.graph.getViewState());for(var m in f)try{this.patchViewStateProperty(b,f,m)}catch(d){}b==this.currentPage&&this.editor.graph.setViewState(b.viewState,!0)}};EditorUi.prototype.patchViewStateProperty=function(b,f,m){b.viewState[m]=JSON.parse(f[m])};