Skip to content

Fix xbcloud out of range memory read #1538

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

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

imrivera
Copy link

@imrivera imrivera commented Jan 17, 2024

Fix a memory out of bounds read when chunk_name.size() < 21

- if (chunk_name.size() < 22 && chunk_name[chunk_name.size() - 21] != '.') {
+ if (chunk_name.size() < 22 || chunk_name[chunk_name.size() - 21] != '.') {
chunk_name.size() Before (&&) After (||)
< 21 - 1st condition is true
- 2nd condition use negative index
- 1st condition is true
- 2nd condition not evaluated
== 21 - 1st condition is true
- 2nd condition using index 0, ok but useless if we want names longer than 21 chars
- 1st condition is true
- 2nd condition not evaluated
>= 22 - 1st condition is false
- 2nd condition is not evaluated
- 1st condition is false
- 2nd condition is evaluated with an index always > 0

@it-percona-cla
Copy link

it-percona-cla commented Jan 17, 2024

CLA assistant check
All committers have signed the CLA.

@satya-bodapati
Copy link
Contributor

Thank you for the contribution @imrivera ! Fix looks good. I will verify with ASAN/vaglrind tests and merge it to the next upcoming releases.

@satya-bodapati
Copy link
Contributor

satya-bodapati commented Jul 30, 2024

Hi @imrivera, I just want to know if you reproduced this bug/behavior somehow. While I agree this is a bug from reading the code, I want to reproduce this bug. Since the default suffix name '.0000000000..' is 21 characters long, it should be impossible to get a chunk name less than this length.

Please let me know if you have a way to reproduce or how you found out this bug?

@imrivera
Copy link
Author

Hi @imrivera, I just want to know if you reproduced this bug/behavior somehow. While I agree this is a bug from reading the code, I want to reproduce this bug. Since the default suffix name '.0000000000..' is 21 characters long, it should be impossible to get a chunk name less than this length.

Please let me know if you have a way to reproduce or how you found out this bug?

I found it just reading the code. I was trying to figure out some things about the naming scheme.

@satya-bodapati satya-bodapati changed the base branch from trunk to 8.0 December 13, 2024 14:42
@satya-bodapati satya-bodapati changed the base branch from 8.0 to trunk December 13, 2024 14:42
@imrivera
Copy link
Author

@satya-bodapati any news on merging this PR?

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