firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

Database: setValue hangs when data contains some invalid keys

Open onyck opened this issue 3 years ago • 3 comments

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!

onyck avatar Dec 15 '22 21:12 onyck

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar Dec 15 '22 21:12 google-oss-bot

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

Change back

Nevalynn88 avatar Jan 11 '24 20:01 Nevalynn88

Change back

Nevalynn88 avatar Jan 11 '24 20:01 Nevalynn88