From aff07bc63d030438e2f1bb4178f0d02c5b8a2c83 Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Thu, 26 Jan 2017 23:18:12 +0100
Subject: Make app_lua_mark() stupidity resistant
---
hex.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/hex.c b/hex.c
index ea09f04..ade7d32 100644
--- a/hex.c
+++ b/hex.c
@@ -988,6 +988,10 @@ app_lua_chunk_newindex (lua_State *L)
static void
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);
g_ctx.marks[g_ctx.marks_len++] =
(struct mark) { offset, len, g_ctx.mark_strings.len };
--
cgit v1.2.3-70-g09d2