mirror of
https://github.com/github/codeql.git
synced 2026-02-19 08:23:45 +01:00
Tolerate tokens containing invalid UTF-8
This commit is contained in:
@@ -503,9 +503,7 @@ impl Visitor<'_> {
|
||||
// Emit a slice of a source file as an Arg.
|
||||
fn sliced_source_arg(source: &Vec<u8>, n: Node) -> Arg {
|
||||
let range = n.byte_range();
|
||||
Arg::String(String::from(
|
||||
std::str::from_utf8(&source[range.start..range.end]).expect("Failed to decode string"),
|
||||
))
|
||||
Arg::String(String::from_utf8_lossy(&source[range.start..range.end]).into_owned())
|
||||
}
|
||||
|
||||
// Emit a pair of `TrapEntry`s for the provided node, appropriately calibrated.
|
||||
|
||||
Reference in New Issue
Block a user