This is a clone of issue OCPBUGS-43041. The following is the description of the original issue:
—
Description of problem:
A slice of something like idPointers := make([]*string, len(ids)) should be corrected to idPointers := make([]*string, 0, len(ids)) When the initial size is not provided to the make for slice creating, the slice is made to length (last argument) and filled with the default value. For instance _ := make([]int, 5) creates an array {0, 0, 0, 0, 0}. If this appended to rather than accessing and setting the information by index, then there are extra values. 1. If we append to the array then we leave behind the default values (this could change the behavior of the function that the array is passed to). This could also pose as a malloc issue. 2. If we dont fill the array completely (ie. create a size of 5 and only fill 4 elements), then the same issue as above could come in to play.
Version-Release number of selected component (if applicable):
How reproducible:
Steps to Reproduce:
1. 2. 3.
Actual results:
Expected results:
Additional info:
- clones
-
OCPBUGS-43041 fix slice init length
- Verified
- is blocked by
-
OCPBUGS-43041 fix slice init length
- Verified
- links to
-
RHBA-2024:10518 OpenShift Container Platform 4.17.z bug fix update