forked from Mirror/wren
Don't overflow signature string if there are too many parameters.
Fix #494.
This commit is contained in:
@ -1704,7 +1704,11 @@ static void signatureParameterList(char name[MAX_METHOD_SIGNATURE], int* length,
|
|||||||
int numParams, char leftBracket, char rightBracket)
|
int numParams, char leftBracket, char rightBracket)
|
||||||
{
|
{
|
||||||
name[(*length)++] = leftBracket;
|
name[(*length)++] = leftBracket;
|
||||||
for (int i = 0; i < numParams; i++)
|
|
||||||
|
// This function may be called with too many parameters. When that happens,
|
||||||
|
// a compile error has already been reported, but we need to make sure we
|
||||||
|
// don't overflow the string too, hence the MAX_PARAMETERS check.
|
||||||
|
for (int i = 0; i < numParams && i < MAX_PARAMETERS; i++)
|
||||||
{
|
{
|
||||||
if (i > 0) name[(*length)++] = ',';
|
if (i > 0) name[(*length)++] = ',';
|
||||||
name[(*length)++] = '_';
|
name[(*length)++] = '_';
|
||||||
|
|||||||
3
test/regression/494.wren
Normal file
3
test/regression/494.wren
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
0[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||||
|
// expect error line 1
|
||||||
|
// expect error line 4
|
||||||
Reference in New Issue
Block a user