Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[L1] CSCTF fix issue with writing beyond array boundaries #37707

Merged
merged 1 commit into from
Apr 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions EventFilter/CSCTFRawToDigi/plugins/CSCTFUnpacker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ void CSCTFUnpacker::produce(edm::Event& e, const edm::EventSetup& c) {
if (lct.empty())
continue;

status.link_status[lct[0].spInput()] |= (1 << lct[0].receiver_status_frame1()) |
(1 << lct[0].receiver_status_frame2()) |
((lct[0].aligment_fifo() ? 1 : 0) << 4);
status.link_status[lct[0].spInput() - 1] |= (1 << lct[0].receiver_status_frame1()) |
Copy link
Contributor

@perrotta perrotta Apr 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is always dangerous to make differences of unsigned quantities.
On the other hand, CSCSP_MEblock::spInput_ is defined as being in the range [1-15], and the same difference is already used later on in this very same code in:

int station = (lct->spInput() > 6 ? (lct->spInput() - 1) / 3 : 1);

and
int subsector = (lct->spInput() > 6 ? 0 : (lct->spInput() - 1) / 3 + 1);

I assume therefore that is also safe to have the same difference computed here

(1 << lct[0].receiver_status_frame2()) |
((lct[0].aligment_fifo() ? 1 : 0) << 4);
status.mpc_link_id |= (lct[0].link() << 2) | lct[0].mpc();

int station = (FPGA ? FPGA : 1);
Expand Down