Merge pull request #10282 from hashicorp/b-hcl-null

vendor: update HCL to catch null chars
This commit is contained in:
Mitchell Hashimoto 2016-11-21 18:19:29 -08:00 committed by GitHub
commit 3f637acc71
4 changed files with 38 additions and 23 deletions

View File

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

Binary file not shown.

View File

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

46
vendor/vendor.json vendored
View File

@ -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=",