lua fix potential null warning

I'm not sure this would happen but I suspect its possible to get malformed
data back from lineinfo as this is how the error system tracks code flow
and this is a hacked add-on to allow RLE (run length encoding) of
said code flow data

Change-Id: I4b914c632935f8b1a9fa960212c58e810b2db738
This commit is contained in:
William Wilgus 2021-07-19 21:52:07 -04:00 committed by William Wilgus
parent 1fd190d02d
commit 074daea51f

View file

@ -802,8 +802,10 @@ static unsigned char *growLineInfo(FuncState *fs) {
unsigned char, MAX_INT, "code size overflow"); unsigned char, MAX_INT, "code size overflow");
p = &f->packedlineinfo[start]; p = &f->packedlineinfo[start];
memset(p, INFO_FILL_BYTE, f->sizelineinfo - start); if (p && f->sizelineinfo > 0) {
f->packedlineinfo[f->sizelineinfo - 1] = '\0'; memset(p, INFO_FILL_BYTE, f->sizelineinfo - start);
f->packedlineinfo[f->sizelineinfo - 1] = '\0';
}
return p; return p;
} }