diff options
author | Neil <nyamatongwe@gmail.com> | 2023-12-08 09:48:08 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2023-12-08 09:48:08 +1100 |
commit | 61e7372258a5446bfdfe00f8f1006f99b859716a (patch) | |
tree | 6db561369a856aaddc3579bfd4af33a5058d2956 /src | |
parent | 735b490e3e29c6ee2cce6a723f900a5394e38399 (diff) | |
download | scintilla-mirror-61e7372258a5446bfdfe00f8f1006f99b859716a.tar.gz |
Throw error when allocating more than 2G without SC_DOCUMENTOPTION_TEXT_LARGE.
Diffstat (limited to 'src')
-rw-r--r-- | src/CellBuffer.cxx | 4 |
1 files changed, 4 insertions, 0 deletions
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 <cstring> #include <cstdio> #include <cstdarg> +#include <climits> #include <stdexcept> #include <string> @@ -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); |