glslang->SPV: Fix addStringOperand so it saves the string argument early, before the str parameter variable is modified. Otherwise you save a garbage string (buffer overrun?) because "str" has run past the terminating NUL. Contributor: Â Lei Zhang antiagainst@google.com

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31108 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2015-05-08 00:45:31 +00:00
parent a0096021d9
commit 1cfc71b73e

View File

@ -84,6 +84,7 @@ public:
void addImmediateOperand(unsigned int immediate) { operands.push_back(immediate); }
void addStringOperand(const char* str)
{
originalString = str;
string = new std::vector<unsigned int>;
unsigned int word;
char* wordString = (char*)&word;
@ -108,8 +109,6 @@ public:
*(wordPtr++) = 0;
string->push_back(word);
}
originalString = str;
}
Op getOpCode() const { return opCode; }
int getNumOperands() const { return operands.size(); }