Skip to content

iOS crash if platform message has invalid UTF8 #31525

@dnfield

Description

@dnfield

FlutterCodecs.mm uses NSJSONSerialization to encode/decode platform messages.

If the Dart side sends invalid UTF8 sequences, NSJSONSerialization fails to decode or encode (and we ignore the error). We then assert that we successfully encoded/decoded, and die.

We should not crash in this case. Ideally we'd do what Android does and add replacement characters.

We should make sure the framework doesn't encode bad data if possible, but we should also make the platform side more resillient.

/cc @GaryQian @jason-simmons from discussion offline.

See also #30851

Metadata

Metadata

Assignees

Labels

c: crashStack traces logged to the consoleengineflutter/engine related. See also e: labels.packageflutter/packages repository. See also p: labels.platform-iosiOS applications specificallywaiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions