aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2017-01-26 23:18:12 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2017-01-26 23:19:36 +0100
commitaff07bc63d030438e2f1bb4178f0d02c5b8a2c83 (patch)
treef4085d2b9fefbe393e3340fb4b548e7aaaf787b5
parentf4a462bd43679e625968988ab162f96bf2ca7977 (diff)
downloadhex-aff07bc63d030438e2f1bb4178f0d02c5b8a2c83.tar.gz
hex-aff07bc63d030438e2f1bb4178f0d02c5b8a2c83.tar.xz
hex-aff07bc63d030438e2f1bb4178f0d02c5b8a2c83.zip
Make app_lua_mark() stupidity resistant
-rw-r--r--hex.c4
1 files changed, 4 insertions, 0 deletions
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 };