aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/CellBuffer.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2023-12-08 09:48:08 +1100
committerNeil <nyamatongwe@gmail.com>2023-12-08 09:48:08 +1100
commit61e7372258a5446bfdfe00f8f1006f99b859716a (patch)
tree6db561369a856aaddc3579bfd4af33a5058d2956 /src/CellBuffer.cxx
parent735b490e3e29c6ee2cce6a723f900a5394e38399 (diff)
downloadscintilla-mirror-61e7372258a5446bfdfe00f8f1006f99b859716a.tar.gz
Throw error when allocating more than 2G without SC_DOCUMENTOPTION_TEXT_LARGE.
Diffstat (limited to 'src/CellBuffer.cxx')
-rw-r--r--src/CellBuffer.cxx4
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);