这是indexloc提供的服务,不要输入任何密码
Skip to content

Incorrect Usage of SQLITE_OPEN_FILEPROTECTION_NONE in FIRMessagingRmqManager.m #12900

@doganaltinbas

Description

@doganaltinbas

Description

Description:
In the method - (void)openDatabase within the file FIRMessagingRmqManager.m, the constant SQLITE_OPEN_FILEPROTECTION_NONE is erroneously passed to the function sqlite3_open_v2(...). This issue is akin to the problem reported for Remote Config in issue #10884 and has now surfaced in the Messaging module. Notably, SQLITE_OPEN_FILEPROTECTION_NONE is not a standard flag provided by SQLite; rather, it's specific to Apple's version of SQLite and has not been merged into the main repository.

Current Implementation:
The following line in the FIRMessagingRmqManager.m,

      int result = sqlite3_open_v2(
          [path UTF8String], &self -> _database,
          SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FILEPROTECTION_NONE, NULL);

Proposed Solution:
To address this issue, the following modifications can be made to the FIRMessagingRmqManager.m file:
Replace the existing line with the following lines:

        int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
    #ifdef SQLITE_OPEN_FILEPROTECTION_NONE
        flags |= SQLITE_OPEN_FILEPROTECTION_NONE;
    #endif
        
        int result = sqlite3_open_v2(
            [path UTF8String], &self -> _database, flags, NULL);

This solution mirrors the approach(#12548) implemented for issue #10884 and ensures compatibility with both Apple's SQLite version and the main repository.

Reproducing the issue

No response

Firebase SDK Version

10.25.0

Xcode Version

15.3

Installation Method

Swift Package Manager

Firebase Product(s)

Messaging

Targeted Platforms

iOS

Relevant Log Output

No response

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions