From 61e7372258a5446bfdfe00f8f1006f99b859716a Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 8 Dec 2023 09:48:08 +1100 Subject: Throw error when allocating more than 2G without SC_DOCUMENTOPTION_TEXT_LARGE. --- src/CellBuffer.cxx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index 3c11939f4..32cc9d730 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -773,6 +774,9 @@ Sci::Position CellBuffer::Length() const noexcept { } void CellBuffer::Allocate(Sci::Position newSize) { + if (!largeDocument && (newSize > INT32_MAX)) { + throw std::runtime_error("CellBuffer::Allocate: size of standard document limited to 2G."); + } substance.ReAllocate(newSize); if (hasStyles) { style.ReAllocate(newSize); -- cgit v1.2.3