Language: JavaScript
Label: vulnerable
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:
DrawioFile.prototype.mergeFile=function(b,e,k,n){var D=!0;try{this.stats.fileMerged++;var t=this.getShadowPages(),E=b.getShadowPages();if(null!=E&&0<E.length){var d=[this.ui.diffPages(null!=n?n:t,E)],f=this.ignorePatches(d);this.setShadowPages(E);if(f)EditorUi.debug("File.mergeFile",[this],"file",[b],"ignored",f);else{null!=this.sync&&this.sync.sendLocalChanges();this.backupPatch=this.isModified()?this.ui.diffPages(t,this.ui.pages):null;n={};f={};var g=this.ui.patchPages(t,d[0]),l=this.ui.getHashValueForPages(g,
n),q=this.ui.getHashValueForPages(E,f);EditorUi.debug("File.mergeFile",[this],"file",[b],"shadow",t,"pages",this.ui.pages,"patches",d,"backup",this.backupPatch,"checksum",l,"current",q,"valid",l==q,"from",this.getCurrentRevisionId(),"to",b.getCurrentRevisionId(),"modified",this.isModified());if(null!=l&&l!=q){var y=this.compressReportData(this.getAnonymizedXmlForPages(E)),F=this.compressReportData(this.getAnonymizedXmlForPages(g)),C=this.ui.hashValue(b.getCurrentEtag()),H=this.ui.hashValue(this.getCurrentEtag());
this.checksumError(k,d,"Shadow Details: "+JSON.stringify(n)+"\nChecksum: "+l+"\nCurrent: "+q+"\nCurrent Details: "+JSON.stringify(f)+"\nFrom: "+C+"\nTo: "+H+"\n\nFile Data:\n"+y+"\nPatched Shadow:\n"+F,null,"mergeFile");return}if(null!=this.sync){var G=this.sync.patchRealtime(d,DrawioFile.LAST_WRITE_WINS?this.backupPatch:null);null==G||mxUtils.isEmptyObject(G)||d.push(G)}this.patch(d,DrawioFile.LAST_WRITE_WINS?this.backupPatch:null)}}else throw D=!1,Error(mxResources.get("notADiagramFile"));this.inConflictState=
this.invalidChecksum=!1;this.setDescriptor(b.getDescriptor());this.descriptorChanged();this.backupPatch=null;null!=e&&e()}catch(ba){this.invalidChecksum=this.inConflictState=!0;this.descriptorChanged();null!=k&&k(ba);try{if(D)if(this.errorReportsEnabled)this.sendErrorReport("Error in mergeFile",null,ba);else{var aa=this.getCurrentUser(),da=null!=aa?aa.id:"unknown";EditorUi.logError("Error in mergeFile",null,this.getMode()+"."+this.getId(),da,ba)}}catch(Y){}}};