summaryrefslogtreecommitdiff
path: root/std/encoding/toml.ts
diff options
context:
space:
mode:
authordanielwippermann <daniel.wippermann@gmail.com>2020-08-17 23:48:15 +0200
committerGitHub <noreply@github.com>2020-08-17 17:48:15 -0400
commit93e2bfe22e5cc782e7d502616dad1fd70d26ae37 (patch)
tree1f77ac602026252595ae7ac334bedec4487a79a6 /std/encoding/toml.ts
parent95a6812e82fbac0826e5e230eef714ce85953125 (diff)
fix(std/encoding/toml): Stop TOML parser from detecting numbers in strings. (#7064)
Before this patch the TOML parser would incorrect treat the string "base64data0xdamaged" in a declaration as a hex number because the corresponding check triggers even when the "0x" is inside a double quoted string literal as long as it is followed by at least one hex character.
Diffstat (limited to 'std/encoding/toml.ts')
-rw-r--r--std/encoding/toml.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/std/encoding/toml.ts b/std/encoding/toml.ts
index bd6814ac3..121459dbf 100644
--- a/std/encoding/toml.ts
+++ b/std/encoding/toml.ts
@@ -218,7 +218,7 @@ class Parser {
}
// If binary / octal / hex
- const hex = /(0(?:x|o|b)[0-9a-f_]*)[^#]/gi.exec(dataString);
+ const hex = /^(0(?:x|o|b)[0-9a-f_]*)[^#]/gi.exec(dataString);
if (hex && hex[0]) {
return hex[0].trim();
}