Skip to content

Database: setValue hangs when data contains some invalid keys #10584

Open
@onyck

Description

@onyck

Description

When DatabaseReference.setValue is passed data that contains a key with a non-printable ascii character, or a key that exceeds the 768 byte limit, the function does not throw an error and never returns.

Expected: The function throws an error when encountering these invalid keys.

Reproducing the issue

Key with a non-printable ascii character:

do {
    try await ref.setValue(["\n": "value"])
    print("This is never printed")
} catch {
    print("This is never printed")
}

Similarly with a long key:

do {
    try await ref.setValue([String(repeating: "a", count: 800): "value"])
    print("This is never printed")
} catch {
    print("This is never printed")
}

Firebase SDK Version

9.6.0

Xcode Version

14.0.1

Installation Method

Swift Package Manager

Firebase Product(s)

Database

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

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions