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

libkmod: Improve strbuf handling in libkmod-index.c #152

Closed
wants to merge 3 commits into from

Conversation

stoeckmann
Copy link
Contributor

  • Turn unsigned int lengths into size_t to stay in sync with latest strbuf changes
  • Check strbuf function return values, because they might fail. If they fail, push and pop operations might run out of sync

@stoeckmann
Copy link
Contributor Author

... and fixed a typo while at it.

Copy link
Collaborator

@evelikov evelikov left a comment

Choose a reason for hiding this comment

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

Food for thought : If we're willing to live with a small hack, we can fold index_mm_node and index_node_f alongside a bunch of the helpers. have a single index_node struct instead of mm and f variants, which will allow us to also de-duplicate the helpers.

This PR looks good though.

@stoeckmann stoeckmann force-pushed the index_strbuf branch 2 times, most recently from abfbcb2 to 8e014fc Compare September 28, 2024 10:18
The unsigned int data type might be too small on 64 bit systems and
when encountering huge and illegal index files.

Since lengths are retrieved from strbuf structs, this also keeps
the data type lengths in sync.

Signed-off-by: Tobias Stoeckmann <[email protected]>
The strbuf functions may fail, so handle errors. Make especially sure
that push and pop operations stay in sync.

Signed-off-by: Tobias Stoeckmann <[email protected]>
Signed-off-by: Tobias Stoeckmann <[email protected]>
lucasdemarchi pushed a commit that referenced this pull request Oct 1, 2024
The unsigned int data type might be too small on 64 bit systems and
when encountering huge and illegal index files.

Since lengths are retrieved from strbuf structs, this also keeps
the data type lengths in sync.

Signed-off-by: Tobias Stoeckmann <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Link: #152
Signed-off-by: Lucas De Marchi <[email protected]>
lucasdemarchi pushed a commit that referenced this pull request Oct 1, 2024
The strbuf functions may fail, so handle errors. Make especially sure
that push and pop operations stay in sync.

Signed-off-by: Tobias Stoeckmann <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Link: #152
Signed-off-by: Lucas De Marchi <[email protected]>
lucasdemarchi pushed a commit that referenced this pull request Oct 1, 2024
Signed-off-by: Tobias Stoeckmann <[email protected]>
Reviewed-by: Emil Velikov <[email protected]>
Link: #152
Signed-off-by: Lucas De Marchi <[email protected]>
@lucasdemarchi
Copy link
Contributor

Applied, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants