{"action":"created","issue":{"url":"https://api.github.com/repos/KhronosGroup/glslang/issues/627","repository_url":"https://api.github.com/repos/KhronosGroup/glslang","labels_url":"https://api.github.com/repos/KhronosGroup/glslang/issues/627/labels{/name}","comments_url":"https://api.github.com/repos/KhronosGroup/glslang/issues/627/comments","events_url":"https://api.github.com/repos/KhronosGroup/glslang/issues/627/events","html_url":"https://github.com/KhronosGroup/glslang/pull/627","id":195286477,"number":627,"title":"Fix out-of-bounds array access, caught by AddressSanitizer","user":{"login":"hrydgard","id":130929,"avatar_url":"https://avatars.githubusercontent.com/u/130929?v=3","gravatar_id":"","url":"https://api.github.com/users/hrydgard","html_url":"https://github.com/hrydgard","followers_url":"https://api.github.com/users/hrydgard/followers","following_url":"https://api.github.com/users/hrydgard/following{/other_user}","gists_url":"https://api.github.com/users/hrydgard/gists{/gist_id}","starred_url":"https://api.github.com/users/hrydgard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hrydgard/subscriptions","organizations_url":"https://api.github.com/users/hrydgard/orgs","repos_url":"https://api.github.com/users/hrydgard/repos","events_url":"https://api.github.com/users/hrydgard/events{/privacy}","received_events_url":"https://api.github.com/users/hrydgard/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-12-13T15:40:50Z","updated_at":"2016-12-15T00:06:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/KhronosGroup/glslang/pulls/627","html_url":"https://github.com/KhronosGroup/glslang/pull/627","diff_url":"https://github.com/KhronosGroup/glslang/pull/627.diff","patch_url":"https://github.com/KhronosGroup/glslang/pull/627.patch"},"body":"Not entirely clear why this happens, but it does, compiling some simple HLSL shaders. Doesn't seem to have any ill effects and causes no warnings under Visual Studio's debug mode, but I get this using AddressSanitizer on the Mac.\r\n\r\nI can provide shader examples if needed, but they are very simple and do validate using D3DCompile without issues.\r\n\r\nASAN log:\r\n\r\n```\r\nASAN:DEADLYSIGNAL\r\n=================================================================\r\n==35026==ERROR: AddressSanitizer: SEGV on unknown address 0x000600000004 (pc 0x00010674024f bp 0x7fff59b5db00 sp 0x7fff59b5da70 T0)\r\n    #0 0x10674024e in std::__1::vector<unsigned int, std::__1::allocator<unsigned int> >::__annotate_shrink(unsigned long) const vector:858\r\n    #1 0x1062ebab4 in std::__1::vector<unsigned int, std::__1::allocator<unsigned int> >::__RAII_IncreaseAnnotator::~__RAII_IncreaseAnnotator() vector:872\r\n    #2 0x1062eb5a4 in std::__1::vector<unsigned int, std::__1::allocator<unsigned int> >::__RAII_IncreaseAnnotator::~__RAII_IncreaseAnnotator() vector:870\r\n    #3 0x1063036c9 in std::__1::enable_if<__is_forward_iterator<unsigned int*>::value, void>::type std::__1::vector<unsigned int, std::__1::allocator<unsigned int> >::__construct_at_end<unsigned int*>(unsigned int*, unsigned int*, unsigned long) vector:1025\r\n    #4 0x1067d97a9 in std::__1::enable_if<(__is_forward_iterator<unsigned int*>::value) && (is_constructible<unsigned int, std::__1::iterator_traits<unsigned int*>::reference>::value), void>::type std::__1::vector<unsigned int, std::__1::allocator<unsigned int> >::assign<unsigned int*>(unsigned int*, unsigned int*) vector:1405\r\n    #5 0x106377b2c in spv::Builder::accessChainPushSwizzle(std::__1::vector<unsigned int, std::__1::allocator<unsigned int> >&, unsigned int) vector:1357\r\n    #6 0x106310c20 in (anonymous namespace)::TGlslangToSpvTraverser::visitBinary(glslang::TVisit, glslang::TIntermBinary*) GlslangToSpv.cpp:1056\r\n    #7 0x1061a1cec in glslang::TIntermBinary::traverse(glslang::TIntermTraverser*) IntermTraverse.cpp:85\r\n    #8 0x106340848 in (anonymous namespace)::TGlslangToSpvTraverser::handleUserFunctionCall(glslang::TIntermAggregate const*) GlslangToSpv.cpp:3048\r\n    #9 0x1063137c5 in (anonymous namespace)::TGlslangToSpvTraverser::visitAggregate(glslang::TVisit, glslang::TIntermAggregate*) GlslangToSpv.cpp:1408\r\n    #10 0x1061a1fb7 in glslang::TIntermAggregate::traverse(glslang::TIntermTraverser*) IntermTraverse.cpp:152\r\n    #11 0x1063362da in (anonymous namespace)::TGlslangToSpvTraverser::translateArguments(glslang::TIntermAggregate const&, std::__1::vector<unsigned int, std::__1::allocator<unsigned int> >&) GlslangToSpv.cpp:2664\r\n    #12 0x106313a25 in (anonymous namespace)::TGlslangToSpvTraverser::visitAggregate(glslang::TVisit, glslang::TIntermAggregate*) GlslangToSpv.cpp:1487\r\n    #13 0x1061a1fb7 in glslang::TIntermAggregate::traverse(glslang::TIntermTraverser*) IntermTraverse.cpp:152\r\n    #14 0x10631624c in (anonymous namespace)::TGlslangToSpvTraverser::visitBranch(glslang::TVisit, glslang::TIntermBranch*) GlslangToSpv.cpp:1880\r\n    #15 0x1061a2a8c in glslang::TIntermBranch::traverse(glslang::TIntermTraverser*) IntermTraverse.cpp:264\r\n    #16 0x1061a25b8 in glslang::TIntermAggregate::traverse(glslang::TIntermTraverser*) IntermTraverse.cpp:168\r\n    #17 0x1061a25b8 in glslang::TIntermAggregate::traverse(glslang::TIntermTraverser*) IntermTraverse.cpp:168\r\n    #18 0x10633fe0d in (anonymous namespace)::TGlslangToSpvTraverser::visitFunctions(glslang::TVector<TIntermNode*> const&) GlslangToSpv.cpp:2638\r\n    #19 0x1063134de in (anonymous namespace)::TGlslangToSpvTraverser::visitAggregate(glslang::TVisit, glslang::TIntermAggregate*) GlslangToSpv.cpp:1357\r\n    #20 0x1061a1fb7 in glslang::TIntermAggregate::traverse(glslang::TIntermTraverser*) IntermTraverse.cpp:152\r\n    #21 0x10630bf75 in glslang::GlslangToSpv(glslang::TIntermediate const&, std::__1::vector<unsigned int, std::__1::allocator<unsigned int> >&, spv::SpvBuildLogger*) GlslangToSpv.cpp:5124\r\n    #22 0x10630bea9 in glslang::GlslangToSpv(glslang::TIntermediate const&, std::__1::vector<unsigned int, std::__1::allocator<unsigned int> >&) GlslangToSpv.cpp:5111\r\n    #23 0x1062e0f4a in SLtoSPV(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Draw::ShaderStage, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, bool) ShaderConvert.cpp:246\r\n    #24 0x1060a283d in ConvertShader(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, Draw::ShaderStage, bool) Convert.cpp:233\r\n    #25 0x10609fb45 in ConvertShaders(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, bool) Convert.cpp:167\r\n    #26 0x10609c7e3 in main Convert.cpp:99\r\n    #27 0x7fff96296254 in start (libdyld.dylib+0x5254)\r\n```"},"comment":{"url":"https://api.github.com/repos/KhronosGroup/glslang/issues/comments/267196415","html_url":"https://github.com/KhronosGroup/glslang/pull/627#issuecomment-267196415","issue_url":"https://api.github.com/repos/KhronosGroup/glslang/issues/627","id":267196415,"user":{"login":"johnkslang","id":5607714,"avatar_url":"https://avatars.githubusercontent.com/u/5607714?v=3","gravatar_id":"","url":"https://api.github.com/users/johnkslang","html_url":"https://github.com/johnkslang","followers_url":"https://api.github.com/users/johnkslang/followers","following_url":"https://api.github.com/users/johnkslang/following{/other_user}","gists_url":"https://api.github.com/users/johnkslang/gists{/gist_id}","starred_url":"https://api.github.com/users/johnkslang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnkslang/subscriptions","organizations_url":"https://api.github.com/users/johnkslang/orgs","repos_url":"https://api.github.com/users/johnkslang/repos","events_url":"https://api.github.com/users/johnkslang/events{/privacy}","received_events_url":"https://api.github.com/users/johnkslang/received_events","type":"User","site_admin":false},"created_at":"2016-12-15T00:06:48Z","updated_at":"2016-12-15T00:06:48Z","body":"So, that's a bad shader.  Need to change\r\n\r\n`flipY(worldPos)` -> `flipY(vertex.worldPos)`\r\n\r\nI increased the robustness of glslang against this in a few places, to handle this more gracefully, in 1e275c8486325aaab34734ad9a650c0121c5efdb.\r\n\r\nWhen I fixed the shader, and tried accessing a component out of range, I got an already existing decent semantic check for that.\r\n\r\nSo, I still don't actually know what triggered your original issue. If you have another shader to post that triggers that, it would still be worth fixing that root cause too."}}
{"actor":{"display_login":"johnkslang"}}