mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/eschr] Don't copy an expr when editing it, if it is too long
Scenario: Create a new sequence which is the multiplication of a lot of imaginary i. Save it (many multiplication sign are added), then try to edit it again, in linear edition mode: the text overflows the buffer. If we still copied it, it might get copied until the middle of a code point, which would make the UTF8Decoder crash afterwards.
This commit is contained in:
committed by
EmilieNumworks
parent
176d55b7fa
commit
9544f1c961
@@ -33,7 +33,11 @@ void ExpressionModel::text(const Storage::Record * record, char * buffer, size_t
|
||||
if (symbol != 0) {
|
||||
e = e.replaceSymbolWithExpression(Symbol::Builder(UCodePointUnknown), Symbol::Builder(symbol));
|
||||
}
|
||||
e.serialize(buffer, bufferSize);
|
||||
int serializedSize = e.serialize(buffer, bufferSize);
|
||||
if (serializedSize >= bufferSize - 1) {
|
||||
// It is very likely that the buffer is overflowed
|
||||
buffer[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool ExpressionModel::isCircularlyDefined(const Storage::Record * record, Poincare::Context * context) const {
|
||||
|
||||
Reference in New Issue
Block a user