diff options
Diffstat (limited to 'src/CellBuffer.cxx')
-rw-r--r-- | src/CellBuffer.cxx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index a770dc335..dfa1350c0 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -10,6 +10,7 @@ #include <stdio.h> #include <stdarg.h> +#include <stdexcept> #include <algorithm> #include "Platform.h" @@ -786,6 +787,10 @@ const Action &CellBuffer::GetUndoStep() const { void CellBuffer::PerformUndoStep() { const Action &actionStep = uh.GetUndoStep(); if (actionStep.at == insertAction) { + if (substance.Length() < actionStep.lenData) { + throw std::runtime_error( + "CellBuffer::PerformUndoStep: deletion must be less than document length."); + } BasicDeleteChars(actionStep.position, actionStep.lenData); } else if (actionStep.at == removeAction) { BasicInsertString(actionStep.position, actionStep.data, actionStep.lenData); |