Skip to content

Commit

Permalink
Merge pull request collin80#458 from CSS-Electronics/feature_support_…
Browse files Browse the repository at this point in the history
…fd_in_comparison

Avoid undefined behavior if FD frame datalengths are present in sorting
  • Loading branch information
collin80 authored May 6, 2022
2 parents 4c2b02c + 405888e commit 9a5d8c5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion canframemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9a5d8c5

Please sign in to comment.