bytecodealliance / bytecodealliance/arf-strings

Error messages in ptr+length languages

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
16
Forks
0
PR merge metrics
No merged PRs in 30d

Description

@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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.