Add an index check to prevent out of index
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.
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.
@HyeockJinKim thank you for the fix! Could you add a simple unit test that reproduces the panic on the original code?
I added 2 test cases. 😄
Can I get a review again? @at-wat
Sorry for the delay, this LGTM!
I agree on returning the partial. It would be nice if we could log, but not available unfortunately.