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:
parent
a0096021d9
commit
1cfc71b73e
@ -84,6 +84,7 @@ public:
|
|||||||
void addImmediateOperand(unsigned int immediate) { operands.push_back(immediate); }
|
void addImmediateOperand(unsigned int immediate) { operands.push_back(immediate); }
|
||||||
void addStringOperand(const char* str)
|
void addStringOperand(const char* str)
|
||||||
{
|
{
|
||||||
|
originalString = str;
|
||||||
string = new std::vector<unsigned int>;
|
string = new std::vector<unsigned int>;
|
||||||
unsigned int word;
|
unsigned int word;
|
||||||
char* wordString = (char*)&word;
|
char* wordString = (char*)&word;
|
||||||
@ -108,8 +109,6 @@ public:
|
|||||||
*(wordPtr++) = 0;
|
*(wordPtr++) = 0;
|
||||||
string->push_back(word);
|
string->push_back(word);
|
||||||
}
|
}
|
||||||
|
|
||||||
originalString = str;
|
|
||||||
}
|
}
|
||||||
Op getOpCode() const { return opCode; }
|
Op getOpCode() const { return opCode; }
|
||||||
int getNumOperands() const { return operands.size(); }
|
int getNumOperands() const { return operands.size(); }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user