Skip to content

Error messages in ptr+length languages #3

@sunfishcode

Description

@sunfishcode

@alexcrichton pointed out that the error messages the current scheme will evoke will be unfortunate in ptr+length languages such as Rust in some cases where the Rust program has mutated the ARF string in an ARF-unaware way.

For an ARF translation like "hello\xffworld" => "\u{feff}hello�world\0hello\0\x7fworld", if Rust code appends a suffix such as ".txt", it'll produce "\u{feff}hello�world\0hello\0\x7fworld.txt". In this case, the embedded NUL will trigger ARF validation, and the validation will fail since the second half ends with ".txt" and the first half doesn't. A typical error message will include the name, which in this case will display as "hello�worldhelloworld.txt", which may confuse users.

Some brainstorming:

  • Encode the entire second half in non-printing characters?
  • Encode strings in the second half as something like base64 which would be printing but less likely to be mistaken for a corrupted string? We could get it to print as something like "hello�world-aGVsbG8gd29ybGQK.txt".
  • Leave it as is?

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