From 0885149492a88677a2ccb3cae177d126bdbd1585 Mon Sep 17 00:00:00 2001 From: Alexey Esaulenko Date: Thu, 18 Jan 2024 15:02:44 +0400 Subject: [PATCH] FrameSender: fix memory corruption while writing to the QCanBusFrame with empty payload --- framesenderwindow.cpp | 2 -- re/flowviewwindow.cpp | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/framesenderwindow.cpp b/framesenderwindow.cpp index 73162e5..a6e867c 100644 --- a/framesenderwindow.cpp +++ b/framesenderwindow.cpp @@ -1054,8 +1054,6 @@ void FrameSenderWindow::processCellChange(int line, int col) } break; case ST_COLS::SENDTAB_COL_DATA: //Data bytes - for (int i = 0; i < 8; i++) sendingData[line].payload().data()[i] = 0; - #if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 ) tokens = ui->tableSender->item(line, ST_COLS::SENDTAB_COL_DATA)->text().split(" ", Qt::SkipEmptyParts); #else diff --git a/re/flowviewwindow.cpp b/re/flowviewwindow.cpp index c51960b..77c088f 100644 --- a/re/flowviewwindow.cpp +++ b/re/flowviewwindow.cpp @@ -851,7 +851,7 @@ void FlowViewWindow::updatePosition(bool forward) int maxVal = qMin(chunk * 8 + 8, frameCache.at(currentPosition).payload().length()); for (int i = chunk * 8; i < maxVal; i++) { - unsigned char thisByte = static_cast(frameCache.at(currentPosition).payload().data()[i]); + unsigned char thisByte = static_cast(frameCache.at(currentPosition).payload()[i]); cngByte = currBytes[i] ^ thisByte; changedBits |= (uint64_t)cngByte << (8ull * (i & 7)); }