facebook / facebook-ios-sdk

Used to integrate the Facebook Platform with your iOS & tvOS apps.

Home Page:https://developers.facebook.com/docs/ios

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash due to EXC_BAD_ACCESS in SensitiveParamsManager.processParameters

5anniversary opened this issue · comments

Checklist before submitting a bug report

Xcode version

15.3.0

Facebook iOS SDK version

17.0.1

Dependency Manager

SPM

SDK Framework

Core

Goals

I aim to ensure that the SensitiveParamsManager.processParameters function in the Facebook SDK processes event parameters reliably and filters sensitive information without causing any crashes due to memory access violations.

Expected results

I expect that all event parameters passed to the function are correctly filtered to remove sensitive information, and the process should handle all inputs without resulting in any memory access errors or application crashes.

Actual results

When processing some event parameters, the application crashes with an EXC_BAD_ACCESS (SIGSEGV) error within the SensitiveParamsManager.processParameters function. This suggests an attempt to access an invalid or unallocated memory address during the parameter processing stage.

Steps to reproduce

No response

Code samples & details

we call in this code

    func setEvent(
        _ eventName: String,
        parameters: [String: Any]?
    ) {
        let facebookEventName: AppEvents.Name = AppEvents.Name(eventName)
        let facebookEventParams: [AppEvents.ParameterName: Any] = transformLogging(parameters)

        AppEvents.shared.logEvent(
            facebookEventName,
            valueToSum: 0,
            parameters: facebookEventParams
        )
    }

    private func transformLogging(
        _ logging: [String: Any]?
    ) -> [AppEvents.ParameterName: Any] {
        var appEventsParams: [AppEvents.ParameterName: Any] = [:]

        guard
            let parameters = logging
        else {
            return appEventsParams
        }

        parameters.forEach { key, value in
            appEventsParams.updateValue(
                value,
                forKey: AppEvents.ParameterName(key)
            )
        }
        return appEventsParams
    }

and we encounter this crash log

OS Version: iOS 17.4.1 (21E236)
Report Version: 104

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: SEGV_NOOP
Crashed Thread: 3

Application Specific Information:
Exception 1, Code 1, Subcode 9223372036854775824 >
KERN_INVALID_ADDRESS at 0x8000000000000010.

Thread 3 Crashed:
0   FBSDKCoreKit                    0x1094a4a50         [inlined] Dictionary.subscript.getter
1   FBSDKCoreKit                    0x1094a4a50         SensitiveParamsManager.processParameters (SensitiveParamsManager.swift:54)
2   FBSDKCoreKit                    0x1094a4a48         SensitiveParamsManager.processParameters (SensitiveParamsManager.swift:54)
3   FBSDKCoreKit                    0x1094a4c88         SensitiveParamsManager.processParameters
4   FBSDKCoreKit                    0x1093fee34         -[FBSDKAppEvents logEvent:valueToSum:parameters:isImplicitlyLogged:accessToken:] (FBSDKAppEvents.m:1168)
5   FBSDKCoreKit                    0x1093fb4d8         -[FBSDKAppEvents logEvent:valueToSum:parameters:accessToken:] (FBSDKAppEvents.m:236)
6   FBSDKCoreKit                    0x1093fb418         -[FBSDKAppEvents logEvent:valueToSum:parameters:] (FBSDKAppEvents.m:225)
7   ably                            0x2056cefac         [inlined] FacebookService.setEvent (FacebookService.swift:23)
8   ably                            0x2056cefac         FacebookEventTracker.logEvent (FacebookEventTracker.swift:31)