Merge pull request #2404 from webzwo0i/sanity-in-atext

block changeset if it deletes more lines than exist in the whole pad
This commit is contained in:
John McLear 2014-12-27 18:36:13 +01:00
commit 7df944b3fd
2 changed files with 14 additions and 1 deletions

View file

@ -742,7 +742,16 @@ function handleUserChanges(data, cb)
return callback(new Error("Can't apply USER_CHANGES "+changeset+" with oldLen " + Changeset.oldLen(changeset) + " to document of length " + prevText.length));
}
pad.appendRevision(changeset, thisSession.author);
try
{
pad.appendRevision(changeset, thisSession.author);
}
catch(e)
{
client.json.send({disconnect:"badChangeset"});
stats.meter('failedChangesets').mark();
return callback(e)
}
var correctionChangeset = _correctMarkersInPad(pad.atext, pad.pool);
if (correctionChangeset) {