Make app_lua_mark() stupidity resistant

This commit is contained in:
Přemysl Eric Janouch 2017-01-26 23:18:12 +01:00
parent f4a462bd43
commit aff07bc63d
Signed by: p
GPG Key ID: B715679E3A361BE6
1 changed files with 4 additions and 0 deletions

4
hex.c
View File

@ -988,6 +988,10 @@ app_lua_chunk_newindex (lua_State *L)
static void static void
app_lua_mark (int64_t offset, int64_t len, const char *desc) app_lua_mark (int64_t offset, int64_t len, const char *desc)
{ {
// That would cause stupid entries, making trouble in marks_by_offset
if (len <= 0)
return;
ARRAY_RESERVE (g_ctx.marks, 1); ARRAY_RESERVE (g_ctx.marks, 1);
g_ctx.marks[g_ctx.marks_len++] = g_ctx.marks[g_ctx.marks_len++] =
(struct mark) { offset, len, g_ctx.mark_strings.len }; (struct mark) { offset, len, g_ctx.mark_strings.len };