Skip to content

Add file size check for OtlpConfigUtils to avoid unsafe cast to int#8287

Merged
jack-berg merged 1 commit into
open-telemetry:mainfrom
jack-berg:file-size-bounds-check
Apr 14, 2026
Merged

Add file size check for OtlpConfigUtils to avoid unsafe cast to int#8287
jack-berg merged 1 commit into
open-telemetry:mainfrom
jack-berg:file-size-bounds-check

Conversation

@jack-berg
Copy link
Copy Markdown
Member

No description provided.

@jack-berg jack-berg requested a review from a team as a code owner April 13, 2026 21:49
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 13, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.26%. Comparing base (a6fadff) to head (f33cd37).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...lemetry/exporter/otlp/internal/OtlpConfigUtil.java 50.00% 1 Missing and 1 partial ⚠️

❌ Your patch status has failed because the patch coverage (50.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8287      +/-   ##
============================================
- Coverage     90.27%   90.26%   -0.01%     
  Complexity     7684     7684              
============================================
  Files           850      850              
  Lines         23186    23189       +3     
  Branches       2352     2353       +1     
============================================
+ Hits          20931    20932       +1     
- Misses         1530     1531       +1     
- Partials        725      726       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

try (RandomAccessFile raf = new RandomAccessFile(file, "r")) {
byte[] bytes = new byte[(int) raf.length()];
long length = raf.length();
if (length > Integer.MAX_VALUE) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not practical to unit test this. Requires a 2gb file.

@jack-berg jack-berg merged commit 1153ffb into open-telemetry:main Apr 14, 2026
26 of 27 checks passed
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