summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/plugins/lua/lcode.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/plugins/lua/lcode.c b/apps/plugins/lua/lcode.c
index 18102d460e..bf031436e8 100644
--- a/apps/plugins/lua/lcode.c
+++ b/apps/plugins/lua/lcode.c
@@ -802,8 +802,10 @@ static unsigned char *growLineInfo(FuncState *fs) {
unsigned char, MAX_INT, "code size overflow");
p = &f->packedlineinfo[start];
- memset(p, INFO_FILL_BYTE, f->sizelineinfo - start);
- f->packedlineinfo[f->sizelineinfo - 1] = '\0';
+ if (p && f->sizelineinfo > 0) {
+ memset(p, INFO_FILL_BYTE, f->sizelineinfo - start);
+ f->packedlineinfo[f->sizelineinfo - 1] = '\0';
+ }
return p;
}