From 9cc52d83de0b1b09d9b8fe6fa77d922cb2ac1583 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 21 Nov 2016 18:11:11 -0800 Subject: [PATCH 1/2] config: test that null characters show up as errors in parse --- config/loader_test.go | 9 +++++++++ config/test-fixtures/git-crypt.tf | Bin 0 -> 13 bytes 2 files changed, 9 insertions(+) create mode 100644 config/test-fixtures/git-crypt.tf diff --git a/config/loader_test.go b/config/loader_test.go index 661be3b58851..f7fad33c038a 100644 --- a/config/loader_test.go +++ b/config/loader_test.go @@ -49,6 +49,15 @@ func TestLoadFile_badType(t *testing.T) { } } +func TestLoadFile_gitCrypt(t *testing.T) { + _, err := LoadFile(filepath.Join(fixtureDir, "git-crypt.tf")) + if err == nil { + t.Fatal("should have error") + } + + t.Logf("err: %s", err) +} + func TestLoadFile_lifecycleKeyCheck(t *testing.T) { _, err := LoadFile(filepath.Join(fixtureDir, "lifecycle_cbd_typo.tf")) if err == nil { diff --git a/config/test-fixtures/git-crypt.tf b/config/test-fixtures/git-crypt.tf new file mode 100644 index 0000000000000000000000000000000000000000..ecd90886a88b4f7654ce0c6f45160a95597191c9 GIT binary patch literal 13 UcmZQ@_Y83kiVO&0IMl}l02men(EtDd literal 0 HcmV?d00001 From 23c58c6d6242acbfb6be0f582319ae85fc21f029 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 21 Nov 2016 18:16:09 -0800 Subject: [PATCH 2/2] vendor: update HCL --- .../hashicorp/hcl/hcl/scanner/scanner.go | 6 +++ vendor/vendor.json | 46 +++++++++---------- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner.go b/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner.go index 0735d95e06a3..d387794bc140 100644 --- a/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner.go +++ b/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner.go @@ -95,6 +95,12 @@ func (s *Scanner) next() rune { s.srcPos.Column = 0 } + // If we see a null character with data left, then that is an error + if ch == '\x00' && s.buf.Len() > 0 { + s.err("unexpected null character (0x00)") + return eof + } + // debug // fmt.Printf("ch: %q, offset:column: %d:%d\n", ch, s.srcPos.Offset, s.srcPos.Column) return ch diff --git a/vendor/vendor.json b/vendor/vendor.json index c0587caac08a..ee9123be05bb 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -1502,68 +1502,68 @@ { "checksumSHA1": "8OPDk+bKyRGJoKcS4QNw9F7dpE8=", "path": "github.com/hashicorp/hcl", - "revision": "3d702911d9708e8fea66cd77e04bd451ff25d3b1", - "revisionTime": "2016-11-09T22:51:35Z" + "revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", + "revisionTime": "2016-11-22T02:11:24Z" }, { "checksumSHA1": "XQmjDva9JCGGkIecOgwtBEMCJhU=", "path": "github.com/hashicorp/hcl/hcl/ast", - "revision": "3d702911d9708e8fea66cd77e04bd451ff25d3b1", - "revisionTime": "2016-11-09T22:51:35Z" + "revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", + "revisionTime": "2016-11-22T02:11:24Z" }, { "checksumSHA1": "5HVecyfmcTm6OTffEi6LGayQf5M=", "path": "github.com/hashicorp/hcl/hcl/fmtcmd", - "revision": "3d702911d9708e8fea66cd77e04bd451ff25d3b1", - "revisionTime": "2016-11-09T22:51:35Z" + "revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", + "revisionTime": "2016-11-22T02:11:24Z" }, { "checksumSHA1": "croNloscHsjX87X+4/cKOURf1EY=", "path": "github.com/hashicorp/hcl/hcl/parser", - "revision": "3d702911d9708e8fea66cd77e04bd451ff25d3b1", - "revisionTime": "2016-11-09T22:51:35Z" + "revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", + "revisionTime": "2016-11-22T02:11:24Z" }, { "checksumSHA1": "1k1PQRPdYEjeTbXsYz5ZP+Won1w=", "path": "github.com/hashicorp/hcl/hcl/printer", - "revision": "3d702911d9708e8fea66cd77e04bd451ff25d3b1", - "revisionTime": "2016-11-09T22:51:35Z" + "revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", + "revisionTime": "2016-11-22T02:11:24Z" }, { - "checksumSHA1": "lgR7PSAZ0RtvAc9OCtCnNsF/x8g=", + "checksumSHA1": "Zz4271B4Kc+rwwK7cbaRv7STfO8=", "path": "github.com/hashicorp/hcl/hcl/scanner", - "revision": "3d702911d9708e8fea66cd77e04bd451ff25d3b1", - "revisionTime": "2016-11-09T22:51:35Z" + "revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", + "revisionTime": "2016-11-22T02:11:24Z" }, { "checksumSHA1": "/e0ULfQnGeUKiM1+iMnQhImo62k=", "path": "github.com/hashicorp/hcl/hcl/strconv", - "revision": "3d702911d9708e8fea66cd77e04bd451ff25d3b1", - "revisionTime": "2016-11-09T22:51:35Z" + "revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", + "revisionTime": "2016-11-22T02:11:24Z" }, { "checksumSHA1": "c6yprzj06ASwCo18TtbbNNBHljA=", "path": "github.com/hashicorp/hcl/hcl/token", - "revision": "3d702911d9708e8fea66cd77e04bd451ff25d3b1", - "revisionTime": "2016-11-09T22:51:35Z" + "revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", + "revisionTime": "2016-11-22T02:11:24Z" }, { "checksumSHA1": "138aCV5n8n7tkGYMsMVQQnnLq+0=", "path": "github.com/hashicorp/hcl/json/parser", - "revision": "3d702911d9708e8fea66cd77e04bd451ff25d3b1", - "revisionTime": "2016-11-09T22:51:35Z" + "revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", + "revisionTime": "2016-11-22T02:11:24Z" }, { "checksumSHA1": "YdvFsNOMSWMLnY6fcliWQa0O5Fw=", "path": "github.com/hashicorp/hcl/json/scanner", - "revision": "3d702911d9708e8fea66cd77e04bd451ff25d3b1", - "revisionTime": "2016-11-09T22:51:35Z" + "revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", + "revisionTime": "2016-11-22T02:11:24Z" }, { "checksumSHA1": "fNlXQCQEnb+B3k5UDL/r15xtSJY=", "path": "github.com/hashicorp/hcl/json/token", - "revision": "3d702911d9708e8fea66cd77e04bd451ff25d3b1", - "revisionTime": "2016-11-09T22:51:35Z" + "revision": "7cb7455c285ca3bf3362aa4ba6a06a6d6f5c3ba0", + "revisionTime": "2016-11-22T02:11:24Z" }, { "checksumSHA1": "/TJCBetWCMVsOpehJzVk3S/xtWM=",