summaryrefslogtreecommitdiff
path: root/vendor/github.com/BurntSushi/toml/parse.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-04-06 10:56:52 -0400
committerGitHub <noreply@github.com>2022-04-06 10:56:52 -0400
commit6a9c21c4565a9c7ebe5c11bf4152a80cfa4398dc (patch)
tree2461834660453e6b42afb2149986b895c2dbf8af /vendor/github.com/BurntSushi/toml/parse.go
parent8b6f911e4818d02bca65ff263dcb61bfe082a470 (diff)
parentbd4b9c3d571abede09b62621449a3565af5b917c (diff)
downloadpodman-6a9c21c4565a9c7ebe5c11bf4152a80cfa4398dc.tar.gz
podman-6a9c21c4565a9c7ebe5c11bf4152a80cfa4398dc.tar.bz2
podman-6a9c21c4565a9c7ebe5c11bf4152a80cfa4398dc.zip
Merge pull request #13776 from containers/dependabot/go_modules/github.com/BurntSushi/toml-1.1.0
build(deps): bump github.com/BurntSushi/toml from 1.0.0 to 1.1.0
Diffstat (limited to 'vendor/github.com/BurntSushi/toml/parse.go')
-rw-r--r--vendor/github.com/BurntSushi/toml/parse.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/vendor/github.com/BurntSushi/toml/parse.go b/vendor/github.com/BurntSushi/toml/parse.go
index 8269cca17..0420b5ba4 100644
--- a/vendor/github.com/BurntSushi/toml/parse.go
+++ b/vendor/github.com/BurntSushi/toml/parse.go
@@ -220,7 +220,7 @@ func (p *parser) value(it item, parentIsArray bool) (interface{}, tomlType) {
case itemString:
return p.replaceEscapes(it, it.val), p.typeOfPrimitive(it)
case itemMultilineString:
- return p.replaceEscapes(it, stripFirstNewline(stripEscapedNewlines(it.val))), p.typeOfPrimitive(it)
+ return p.replaceEscapes(it, stripFirstNewline(p.stripEscapedNewlines(it.val))), p.typeOfPrimitive(it)
case itemRawString:
return it.val, p.typeOfPrimitive(it)
case itemRawMultilineString:
@@ -647,7 +647,7 @@ func stripFirstNewline(s string) string {
}
// Remove newlines inside triple-quoted strings if a line ends with "\".
-func stripEscapedNewlines(s string) string {
+func (p *parser) stripEscapedNewlines(s string) string {
split := strings.Split(s, "\n")
if len(split) < 1 {
return s
@@ -679,6 +679,10 @@ func stripEscapedNewlines(s string) string {
continue
}
+ if i == len(split)-1 {
+ p.panicf("invalid escape: '\\ '")
+ }
+
split[i] = line[:len(line)-1] // Remove \
if len(split)-1 > i {
split[i+1] = strings.TrimLeft(split[i+1], " \t\r")