Skip to content

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

Merged
merged 92 commits into from
Dec 11, 2024
Merged

Work/dp catalog #2713

merged 92 commits into from
Dec 11, 2024

Conversation

timcanham
Copy link
Collaborator

Related Issue(s)
Has Unit Tests (y/n)
Documentation Included (y/n)

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.

Copy link

@github-advanced-security github-advanced-security bot left a 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.

@timcanham timcanham marked this pull request as ready for review December 4, 2024 23:02
Copy link
Collaborator

@LeStarch LeStarch left a comment

Choose a reason for hiding this comment

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

Commenting partial review.

@bocchino bocchino self-requested a review December 5, 2024 18:49
Copy link
Collaborator

@bocchino bocchino left a 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

  1. 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.
  2. There aren't enough assertions, particularly before pointer dereference ->.

To Fix for this PR If Possible

  1. 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.
  2. For consistency, remove the explicit close operation in loadStateFile. In two other places the implicit operation is used.

Copy link
Collaborator

@LeStarch LeStarch left a 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)) {
Copy link
Collaborator

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);
Copy link
Collaborator

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)) {
Copy link
Collaborator

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)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider.

@LeStarch LeStarch merged commit 05b817f into nasa:devel Dec 11, 2024
32 of 35 checks passed
@LeStarch LeStarch added the Breaking Changes Need to add instructions in the release notes for updates. label Dec 11, 2024
@matt392code
Copy link
Contributor

Missing return value checks:
dp-catalog-checks.txt
This solution:

  1. Adds checks for buffer operations:
    -Buffer length setting
    -Serialization operations
    -Memory allocation
  2. Provides error logging:
    -Specific error codes
    -Warning messages
    -Error type enumeration
  3. Proper error handling:
    -Returns appropriate error responses
    -Maintains system state
    -Prevents undefined behavior
  4. Key improvements:
    -No more unchecked return values
    -Clear error reporting
    -Better system reliability

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking Changes Need to add instructions in the release notes for updates.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants