Skip to content

fix: resolve index out of bounds in diskio stat#260

Merged
khushijain21 merged 1 commit intoelastic:mainfrom
kruskall:fix/out-of-bounds
Aug 26, 2025
Merged

fix: resolve index out of bounds in diskio stat#260
khushijain21 merged 1 commit intoelastic:mainfrom
kruskall:fix/out-of-bounds

Conversation

@kruskall
Copy link
Copy Markdown
Member

What does this PR do?

it's possible on linux to get an empty slice if the file is empty

protect against that by checking the slice len.

It's impossible on darwin but let's not rely on implementation details and also check there.

Why is it important?

prevent index out of bounds error

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.md

Author's Checklist

  • [ ]

Related issues

it's possible on linux to get an empty slice if the file is empty

protect against that by checking the slice len.

It's impossible on darwin but let's not rely on implementation
details and also check there.
@kruskall kruskall requested a review from a team as a code owner August 25, 2025 22:27
@kruskall kruskall requested review from faec and mauri870 and removed request for a team August 25, 2025 22:27
@khushijain21 khushijain21 merged commit f613787 into elastic:main Aug 26, 2025
5 checks passed
@kruskall kruskall deleted the fix/out-of-bounds branch August 26, 2025 12:50
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