Merge pull request #458 from CSS-Electronics/feature_support_fd_in_comparison

Avoid undefined behavior if FD frame datalengths are present in sorting
This commit is contained in:
Collin Kidder
2022-05-05 20:08:23 -04:00
committed by GitHub
+1 -1
View File
@@ -253,7 +253,7 @@ uint64_t CANFrameModel::getCANFrameVal(int row, Column col)
return static_cast<uint64_t>(frame.payload().length());
case Column::ASCII: //sort both the same for now
case Column::Data:
for (int i = 0; i < frame.payload().length(); i++) temp += (static_cast<uint64_t>(frame.payload()[i]) << (56 - (8 * i)));
for (int i = 0; i < std::min(frame.payload().length(), 8); i++) temp += (static_cast<uint64_t>(frame.payload()[i]) << (56 - (8 * i)));
//qDebug() << temp;
return temp;
case Column::NUM_COLUMN: