-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Work/dp catalog #2713
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
Work/dp catalog #2713
Conversation
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.
CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
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.
Commenting partial review.
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.
Looks good to me! Here are my comments.
Not Blocking for This PR
- In
configure
, the partitioning of memory into three pieces uses reinterpret cast on the address of an out-of-bounds array element, and it may not respect alignment requirements. This kind of code should do array access on the underlying byte buffer (so it's in bounds), it should use placement new to create the arrays, and it should respect alignment requirements. - There aren't enough assertions, particularly before pointer dereference
->
.
To Fix for this PR If Possible
- Add comments to
configure
to explain what is going on: (a) We are sizing a triple of arrays as an array of triples. (b) We are using array indexing to compute the address after the end of the array. - For consistency, remove the explicit
close
operation inloadStateFile
. In two other places the implicit operation is used.
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.
Nothing is a blocking fix, but we do need fixes eventually.
|
||
// insert entry into sorted list. if can't insert, quit | ||
if (not this->insertEntry(this->m_dpList[this->m_numDpRecords])) { | ||
if (not this->insertEntry(entry)) { |
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.
Consider fixing this.
|
||
// if the tree is empty, add the first entry | ||
if (this->m_dpTree == nullptr) { | ||
this->allocateNode(this->m_dpTree,entry); |
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.
Must fix. Specifically since it is your return value.
DpCatalog::CheckStat DpCatalog::checkLeftRight(bool condition, DpBtreeNode* &node, const DpStateEntry& newEntry) { | ||
if (condition) { | ||
if (node->left == nullptr) { | ||
if (!this->allocateNode(node->left,newEntry)) { |
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.
Consider.
} | ||
} else { | ||
if (node->right == nullptr) { | ||
if (!this->allocateNode(node->right,newEntry)) { |
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.
Consider.
Missing return value checks:
|
Change Description
A description of the changes contained in the PR.
Rationale
A rationale for this change. e.g. fixes bug, or most projects need XYZ feature.
Testing/Review Recommendations
Fill in testing procedures, specific items to focus on for review, or other info to help the team verify these changes are flight-quality.
Future Work
Note any additional work that will be done relating to this issue.