Release v0.2.390
This pull request improves the robustness of the toLayers
function in pkg/sbommanager/v1/source.go
by handling cases where the ms
slice is shorter than the ds
slice or is nil, and adds comprehensive unit tests to verify its behavior.
Improved error handling and robustness
- Updated the
toLayers
function to check that thems
slice has enough elements before accessing it, preventing potential out-of-bounds errors whenms
is shorter thands
or is nil. ([pkg/sbommanager/v1/source.goL165-R169](diffhunk://#diff-e8fbb3cdbbd84fec27ef49bdf1428f8cbea3bfe05009801a5bbfd1178292df30L165-R169)
)
Test coverage
- Added a new test suite in
pkg/sbommanager/v1/source_test.go
for thetoLayers
function, covering cases with empty, nil, and mismatched layer size slices to ensure correct behavior and edge case handling. ([pkg/sbommanager/v1/source_test.goR1-R95](diffhunk://#diff-7e704476132c470486ae4022b5c856ff856caf61311bd87e6dc1bfb3e58dd8f1R1-R95)
)