{"action":"opened","issue":{"url":"https://api.github.com/repos/golang/go/issues/10612","labels_url":"https://api.github.com/repos/golang/go/issues/10612/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/10612/comments","events_url":"https://api.github.com/repos/golang/go/issues/10612/events","html_url":"https://github.com/golang/go/issues/10612","id":71866886,"number":10612,"title":"html/template: runtime error: slice bounds out of range","user":{"login":"dvyukov","id":1095328,"avatar_url":"https://avatars.githubusercontent.com/u/1095328?v=3","gravatar_id":"","url":"https://api.github.com/users/dvyukov","html_url":"https://github.com/dvyukov","followers_url":"https://api.github.com/users/dvyukov/followers","following_url":"https://api.github.com/users/dvyukov/following{/other_user}","gists_url":"https://api.github.com/users/dvyukov/gists{/gist_id}","starred_url":"https://api.github.com/users/dvyukov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dvyukov/subscriptions","organizations_url":"https://api.github.com/users/dvyukov/orgs","repos_url":"https://api.github.com/users/dvyukov/repos","events_url":"https://api.github.com/users/dvyukov/events{/privacy}","received_events_url":"https://api.github.com/users/dvyukov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"robpike","id":4324516,"avatar_url":"https://avatars.githubusercontent.com/u/4324516?v=3","gravatar_id":"","url":"https://api.github.com/users/robpike","html_url":"https://github.com/robpike","followers_url":"https://api.github.com/users/robpike/followers","following_url":"https://api.github.com/users/robpike/following{/other_user}","gists_url":"https://api.github.com/users/robpike/gists{/gist_id}","starred_url":"https://api.github.com/users/robpike/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robpike/subscriptions","organizations_url":"https://api.github.com/users/robpike/orgs","repos_url":"https://api.github.com/users/robpike/repos","events_url":"https://api.github.com/users/robpike/events{/privacy}","received_events_url":"https://api.github.com/users/robpike/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/1","html_url":"https://github.com/golang/go/milestones/Go1.5","labels_url":"https://api.github.com/repos/golang/go/milestones/1/labels","id":905105,"number":1,"title":"Go1.5","description":"","creator":{"login":"bradfitz","id":2621,"avatar_url":"https://avatars.githubusercontent.com/u/2621?v=3","gravatar_id":"","url":"https://api.github.com/users/bradfitz","html_url":"https://github.com/bradfitz","followers_url":"https://api.github.com/users/bradfitz/followers","following_url":"https://api.github.com/users/bradfitz/following{/other_user}","gists_url":"https://api.github.com/users/bradfitz/gists{/gist_id}","starred_url":"https://api.github.com/users/bradfitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradfitz/subscriptions","organizations_url":"https://api.github.com/users/bradfitz/orgs","repos_url":"https://api.github.com/users/bradfitz/repos","events_url":"https://api.github.com/users/bradfitz/events{/privacy}","received_events_url":"https://api.github.com/users/bradfitz/received_events","type":"User","site_admin":false},"open_issues":317,"closed_issues":368,"state":"open","created_at":"2014-12-16T02:26:41Z","updated_at":"2015-04-29T12:50:26Z","due_on":"2015-07-31T04:00:00Z","closed_at":null},"comments":0,"created_at":"2015-04-29T12:50:25Z","updated_at":"2015-04-29T12:50:25Z","closed_at":null,"body":"The following program crashes with panic:\r\n```go\r\npackage main\r\n\r\nimport (\r\n\t\"html/template\"\r\n\t\"io/ioutil\"\r\n)\r\n\r\nfunc main() {\r\n\tt, err := template.New(\"foo\").Parse(string(data))\r\n\tif err != nil {\r\n\t\treturn\r\n\t}\r\n\tt.Execute(ioutil.Discard, nil)\r\n}\r\n\r\nvar data = \"<style>.000000000000\" +\r\n\t\"00.0000000000V000000\" +\r\n\t\"000\\x880000000000000000\" +\r\n\t\"00\\xa4000\\x8e\\x9200\\x8b\\xe0\\x85\\xbd000000\" +\r\n\t\"0</style\"\r\n\r\n```\r\n```\r\npanic: runtime error: slice bounds out of range\r\n\r\ngoroutine 1 [running]:\r\nhtml/template.contextAfterText(0x20000000001, 0x0, 0xc208020126, 0x52, 0x5a, 0x0, 0x0, 0x6)\r\n\tsrc/html/template/escape.go:671 +0x2db\r\nhtml/template.(*escaper).escapeText(0xc208010540, 0x20000000001, 0x0, 0xc208014810, 0x0, 0x0)\r\n\tsrc/html/template/escape.go:596 +0x199\r\nhtml/template.(*escaper).escape(0xc208010540, 0x0, 0x0, 0x7f4c7b7951e8, 0xc208014810, 0x700000000000000, 0x0)\r\n\tsrc/html/template/escape.go:129 +0x31a\r\nhtml/template.(*escaper).escapeList(0xc208010540, 0x0, 0x0, 0xc2080147e0, 0x0, 0x0)\r\n\tsrc/html/template/escape.go:440 +0x1c9\r\nhtml/template.(*escaper).escapeListConditionally(0xc208010500, 0x0, 0x0, 0xc2080147e0, 0xc2080419b0, 0x0, 0x0, 0x7f4c7b941000)\r\n\tsrc/html/template/escape.go:455 +0x4be\r\nhtml/template.(*escaper).escapeTemplateBody(0xc208010500, 0x0, 0x0, 0xc208010440, 0x0, 0x0, 0xae00000000000058)\r\n\tsrc/html/template/escape.go:573 +0x1e2\r\nhtml/template.(*escaper).computeOutCtx(0xc208010500, 0x0, 0x0, 0xc208010440, 0x0, 0x0)\r\n\tsrc/html/template/escape.go:534 +0xc9\r\nhtml/template.(*escaper).escapeTree(0xc208010500, 0x0, 0x0, 0x7f4c7b795230, 0xc2080147e0, 0x5ba240, 0x3, 0x0, 0x0, 0x0, ...)\r\n\tsrc/html/template/escape.go:527 +0x77f\r\nhtml/template.escapeTemplate(0xc2080146f0, 0x7f4c7b795230, 0xc2080147e0, 0x5ba240, 0x3, 0x0, 0x0)\r\n\tsrc/html/template/escape.go:23 +0x334\r\nhtml/template.(*Template).escape(0xc2080146f0, 0x0, 0x0)\r\n\tsrc/html/template/template.go:85 +0x35d\r\nhtml/template.(*Template).Execute(0xc2080146f0, 0x7f4c7b7951c0, 0xc20800a4c0, 0x0, 0x0, 0x0, 0x0)\r\n\tsrc/html/template/template.go:101 +0x37\r\nmain.main()\r\n\t/tmp/htmltempl.go:13 +0x290\r\n```\r\non commit ccc76db"}}