Skip to content

Fix #522 Signed integer overflow #526

New issue

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

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

Already on GitHub? # to your account

Merged
merged 1 commit into from
Feb 2, 2023
Merged

Fix #522 Signed integer overflow #526

merged 1 commit into from
Feb 2, 2023

Conversation

remicollet
Copy link
Collaborator

No description provided.

@@ -86,7 +86,7 @@ static int php_memc_list_entry(void) {
/****************************************
Payload value flags
****************************************/
#define MEMC_CREATE_MASK(start, n_bits) (((1 << n_bits) - 1) << start)
#define MEMC_CREATE_MASK(start, n_bits) (((1U << n_bits) - 1) << start)
Copy link
Contributor

Choose a reason for hiding this comment

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

I did a bit of reading, found a note that Coverity might interpret 1U as u_char rather than int: https://community.synopsys.com/s/article/False-positive-for-coverity-sees-1-and-1U-as-8-bit-type-variables

The fix would be to use 1UL to make it explicitly 32-bit (unsigned long)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

but 1UL is 64-bit

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, there's a part of my brain that I keep on a shelf for this

@sodabrew sodabrew merged commit 811c8a1 into master Feb 2, 2023
@sodabrew sodabrew deleted the issue-522 branch February 2, 2023 19:42
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants