Skip to content

Fix #522 Signed integer overflow#526

Merged
sodabrew merged 1 commit intomasterfrom
issue-522
Feb 2, 2023
Merged

Fix #522 Signed integer overflow#526
sodabrew merged 1 commit intomasterfrom
issue-522

Conversation

@remicollet
Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread php_memcached.c
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
Copy Markdown
Collaborator

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
Copy Markdown
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
Copy Markdown
Collaborator

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
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.

2 participants