Skip to content
Snippets Groups Projects
Commit ab321959 authored by Vladimir Davydov's avatar Vladimir Davydov
Browse files

vinyl: fix crash in vy_read_iterator_next_range

There's no check that range->begin can be NULL (for the leftmost range)
in vy_read_iterator_next_range(), which leads to a crash when trying to
compare range->begin to last_stmt. Add it.

  #0  0x5621e45fc1b1 in print_backtrace+9
  #1  0x5621e4507b9f in _ZL12sig_fatal_cbi+e2
  #2  0x7f819188c0c0 in __restore_rt+0
  #3  0x5621e456e34b in tuple_data+c
  #4  0x5621e456e814 in vy_tuple_compare_with_key+20
  #5  0x5621e4570cec in vy_read_iterator_next_range+139
  #6  0x5621e456fd87 in vy_read_iterator_next_key+275
  #7  0x5621e45710ad in vy_read_iterator_next+22c
  #8  0x5621e453db42 in vinyl_iterator_next+19a
  #9  0x5621e4513772 in iterator_next+cb
  #10 0x5621e45afe4a in box_select+32d
  #11 0x5621e45d4beb in _ZL11lbox_selectP9lua_State+187
  #12 0x5621e461c96b in lj_BC_FUNCC+34
  #13 0x5621e463f4e3 in lua_pcall+18e
  #14 0x5621e45e870c in luaT_call+29
  #15 0x5621e45e1ad7 in lua_fiber_run_f+c0
  #16 0x5621e4507914 in _ZL16fiber_cxx_invokePFiP13__va_list_tagES0_+1e
  #17 0x5621e45f9ba1 in fiber_loop+82
  #18 0x5621e479b31b in coro_init+4c

Fixes 5e414a73 ("vinyl: read iterator: do not reopen all sources when
range is changed")

Closes #2990
parent 05b3179b
No related branches found
No related tags found
No related merge requests found
......@@ -905,8 +905,9 @@ vy_read_iterator_next_range(struct vy_read_iterator *itr)
vy_tuple_compare_with_key(itr->last_stmt,
range->end, cmp_def) < 0))
break;
if (dir < 0 && vy_tuple_compare_with_key(itr->last_stmt,
range->begin, cmp_def) > 0)
if (dir < 0 && (range->begin == NULL ||
vy_tuple_compare_with_key(itr->last_stmt,
range->begin, cmp_def) > 0))
break;
}
itr->curr_range = range;
......
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