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
fix for out-of-bounds index in HitPattern::getHitPatternByAbsoluteIndex
#36116
Conversation
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-36116/26618
|
A new Pull Request was created by @missirol (Marino Missiroli) for master. It involves the following packages:
@jpata, @cmsbuild, @slava77 can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
@@ -334,6 +334,8 @@ uint16_t HitPattern::getHitPatternByAbsoluteIndex(int position) const { | |||
} else { | |||
uint8_t firstWordBits = HIT_LENGTH - secondWordBits; | |||
uint16_t firstWordBlock = hitPattern[secondWord - 1] >> (16 - firstWordBits); | |||
if (!secondWordBits) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean with !
of a uint8?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wanted this to be true
if all bits were zero.
Testing locally (outside CMSSW) it seemed to work, but I guess I'm missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!= 0
?
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-36116/26620
|
@cmsbuild please test |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-c6635a/20544/summary.html Comparison SummarySummary:
|
Looking at this code, it's not clear why lines 3-4 would do anything different than line 2 if 1: if (secondWordBits == 0)
2: return firstWordBlock;
3: uint16_t secondWordBlock = hitPattern[secondWord] & ((1 << secondWordBits) - 1); //(1<<0)-1 gives secondWordBlock==0
4: uint16_t myResult = firstWordBlock + (secondWordBlock << firstWordBits); //0 << firstWordBits gives 0 |
The difference is that with this change, when |
ah, I see, thanks for the explanation! |
+reconstruction
|
This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @perrotta, @dpiparo, @qliphy (and backports should be raised in the release meeting by the corresponding L2) |
+1 |
PR description:
This PR contains a minor technical fix to
HitPattern::getHitPatternByAbsoluteIndex
.It was prompted by an error detected in last week's UBSAN IB (
step4
of wf4.22
).The error was coming from
secondWord==57
(out of bounds) whenposition==75
.Merely technical. No changes expected.
PR validation:
Tested wf
4.22
with a UBSAN IB.If this PR is a backport, please specify the original PR and why you need to backport that PR:
N/A