facebook / openbmc

OpenBMC is an open software framework to build a complete Linux image for a Board Management Controller (BMC).
633 stars 277 forks source link

flashy: Use safe `BytesSliceRange` for safe slicing #153

Closed lhl2617 closed 3 years ago

lhl2617 commented 3 years ago

Summary

Out-of-bounds slicing in Golang is panicky, and manually checking before slicing is tedious. Use a dedicated function with bounds checks for all bytes slicing.

No functional changes are made

Test plan

Unit tests go test ./...

testhard

facebook-github-bot commented 3 years ago

@kawmarco has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.