rtp icon indicating copy to clipboard operation
rtp copied to clipboard

Add an index check to prevent out of index

Open HyeockJinKim opened this issue 1 year ago • 4 comments

Description

In the current code, binary.BigEndian.Uint16 is causing an out of index panic while traversing the for loop. Add an length check to prevent panic from occurring.

HyeockJinKim avatar May 01 '24 23:05 HyeockJinKim

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 84.12%. Comparing base (bc5124c) to head (321abf8). Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #270      +/-   ##
==========================================
+ Coverage   84.10%   84.12%   +0.02%     
==========================================
  Files          24       24              
  Lines        1950     1953       +3     
==========================================
+ Hits         1640     1643       +3     
  Misses        253      253              
  Partials       57       57              
Flag Coverage Δ
go 84.12% <100.00%> (+0.02%) :arrow_up:
wasm 83.51% <100.00%> (+0.02%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar May 02 '24 02:05 codecov[bot]

@HyeockJinKim thank you for the fix! Could you add a simple unit test that reproduces the panic on the original code?

at-wat avatar May 02 '24 02:05 at-wat

I added 2 test cases. 😄

HyeockJinKim avatar May 02 '24 03:05 HyeockJinKim

Can I get a review again? @at-wat

HyeockJinKim avatar May 07 '24 06:05 HyeockJinKim

Sorry for the delay, this LGTM!

I agree on returning the partial. It would be nice if we could log, but not available unfortunately.

Sean-Der avatar Aug 02 '24 13:08 Sean-Der