Reference to malloc in IPA

The IPA generated for the project contains references to the malloc function, which is flagged as an insecure function. This occurs when using standard higher-order functions such as filter, first, etc., on arrays containing value-type elements.

How can we address or eliminate this security finding?

Example code struct ContentView: View {

let arr = [1,2,3]

var body: some View {
    VStack {
        Image(systemName: "globe")
            .imageScale(.large)
            .foregroundStyle(.tint)
        Text("Hello, world!")
    }
    .padding()
    .onAppear{
        
        let twos = arr.filter{ $0 == 2 }
        
    }
}

}

For testing create simple project name MallocIssue(My script has it).

I have attached script to test malloc reference. Replace below things in script PATH_TO_PROJECT PROFILE_NAME BUNDLE_IDENTIFIER

Place script in parallel to xcodeproj file. then run below commands on terminal on same path.

chmod +x malloc_finder.sh ./malloc_finder.sh

Reference to malloc in IPA
 
 
Q