mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-20 10:12:15 +01:00
Avoid segfault when reading state file from ancient tor
If s_values is null in rep_hist_load_bwhist_state_section, we would call smartlist_len() on it, and die. Fixes bug 6801.
This commit is contained in:
parent
97dbff51e6
commit
8731a4e148
5
changes/bug6801
Normal file
5
changes/bug6801
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
o Minor bugfixes:
|
||||||
|
- Avoid segfault when starting up having run with an extremely old
|
||||||
|
version of Tor and parsing its state file. Fixes bug 6801; bugfix on
|
||||||
|
0.2.2.23-alpha.
|
||||||
|
|
@ -1675,7 +1675,8 @@ rep_hist_load_bwhist_state_section(bw_array_t *b,
|
|||||||
|
|
||||||
uint64_t v, mv;
|
uint64_t v, mv;
|
||||||
int i,ok,ok_m;
|
int i,ok,ok_m;
|
||||||
int have_maxima = (smartlist_len(s_values) == smartlist_len(s_maxima));
|
int have_maxima = s_maxima && s_values &&
|
||||||
|
(smartlist_len(s_values) == smartlist_len(s_maxima));
|
||||||
|
|
||||||
if (s_values && s_begins >= now - NUM_SECS_BW_SUM_INTERVAL*NUM_TOTALS) {
|
if (s_values && s_begins >= now - NUM_SECS_BW_SUM_INTERVAL*NUM_TOTALS) {
|
||||||
start = s_begins - s_interval*(smartlist_len(s_values));
|
start = s_begins - s_interval*(smartlist_len(s_values));
|
||||||
|
Loading…
Reference in New Issue
Block a user