Skip to content
Snippets Groups Projects
Commit e2e5e3d1 authored by Roman Tsisyk's avatar Roman Tsisyk
Browse files

A fix for Bug#1098517 "An out of bounds memory access in lua iterator"

parent db6d2c84
No related branches found
No related tags found
No related merge requests found
......@@ -707,9 +707,13 @@ lbox_index_iterator(struct lua_State *L, enum iterator_type type)
/* Single or multi- part key. */
field_count = argc;
struct tbuf *data = tbuf_alloc(fiber->gc_pool);
for (int i = 0; i < argc; ++i)
append_key_part(L, i + 2, data,
index->key_def->parts[i].type);
for (int i = 0; i < argc; ++i) {
enum field_data_type type = UNKNOWN;
if (i < index->key_def->part_count) {
type = index->key_def->parts[i].type;
}
append_key_part(L, i + 2, data, type);
}
key = data->data;
}
/*
......@@ -818,9 +822,13 @@ lbox_index_count(struct lua_State *L)
/* Single or multi- part key. */
key_part_count = argc;
struct tbuf *data = tbuf_alloc(fiber->gc_pool);
for (int i = 0; i < argc; ++i)
append_key_part(L, i + 2, data,
index->key_def->parts[i].type);
for (int i = 0; i < argc; ++i) {
enum field_data_type type = UNKNOWN;
if (i < index->key_def->part_count) {
type = index->key_def->parts[i].type;
}
append_key_part(L, i + 2, data, type);
}
key = data->data;
}
u32 count = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment