Skip to content

String literals permit invalid UTF-8 #1093

Description

@TristonianJones

Describe the bug

In cel-java, the following expression '\udead' == '\ufffd' correctly errors on the invalid UTF-8 literal; however, cel-go permits the evaluation to proceed.

To Reproduce
Check which components this affects:

  • parser
  • checker
  • interpreter

Sample expression and input that reproduces the issue:

'\udead' == '\ufffd'

Test setup:

env, err := cel.NewEnv()
if err != nil {
   log.Exit(err)
}
ast, iss := env.Parse(`'\udead' == '\ufffd'`)
if iss.Err() == nil {
  log.Exit("Expected invalid unicode error")
}

Expected behavior
Ensure the parser errors when parsing an invalid UTF-8 string literal.

Additional context
cel-expr/cel-spec#420

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions