Skip to content

Fix xbcloud out of range memory read#1538

Open
imrivera wants to merge 1 commit into
percona:trunkfrom
imrivera:fix_out_of_bound_read_in_xbcloud
Open

Fix xbcloud out of range memory read#1538
imrivera wants to merge 1 commit into
percona:trunkfrom
imrivera:fix_out_of_bound_read_in_xbcloud

Conversation

@imrivera

@imrivera imrivera commented Jan 17, 2024

Copy link
Copy Markdown

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

it-percona-cla commented Jan 17, 2024

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@satya-bodapati

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

satya-bodapati commented Jul 30, 2024

Copy link
Copy Markdown
Contributor

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