Skip to content

Commit 7fbdd64

Browse files
committed
fix edbee#140, Fix Array index out of bounds assertion loading with TextDocumentSerializer
1 parent af50584 commit 7fbdd64

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
edbee.lib:
44

5+
- fix #140, Fix Array index out of bounds assertion loading with TextDocumentSerializer
56
- fix #136, BREAKING CHANGE: return type TextEditorController::executeCommand changed to void.
67
- changed TextEditorController slot arguments to fully-qualified types.
78
- ref #136, remove TextDocumentController readonly methods from slots

edbee-lib/edbee/io/textdocumentserializer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ bool TextDocumentSerializer::loadWithoutOpening( QIODevice* ioDevice )
4242
QTextDecoder* textDecoder=0;
4343

4444
// read the buffer
45-
QByteArray bytes(blockSize_ + 1,0);
45+
QByteArray bytes(blockSize_ + 1, 0);
4646
QString remainingBuffer;
4747

4848
/// TODO: atEnd doesn't seem to work !?!
4949
/// TODO: implement isStopRequested to stop loading if required
5050
while( /*ioDeviceRef_->atEnd() &&*/ true /*!isStopRequested()*/ ) {
5151

52-
int bytesRead = ioDevice->read( bytes.data(), blockSize_ );
52+
int bytesRead = ioDevice->read( bytes.data(), blockSize_ - 1);
5353
if( bytesRead > 0 ) {
5454
bytes[bytesRead + 1] = 0; // 0 terminate the read bytes
5555

0 commit comments

Comments
 (0)