diff options
author | Nick Mathewson <nickm@torproject.org> | 2014-09-10 23:46:20 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-09-10 23:48:11 -0400 |
commit | 3c2c6a61163cd6a42cc0eeee9fc43200b9f08503 (patch) | |
tree | 94a717f1d8d0caaf3791c20e600835e0b85588bc /src | |
parent | a9b2e5eac6168a1eb09da8d6d3ff43b08cc51411 (diff) | |
download | tor-3c2c6a61163cd6a42cc0eeee9fc43200b9f08503.tar.gz tor-3c2c6a61163cd6a42cc0eeee9fc43200b9f08503.zip |
In routerlist_assert_ok(), check r2 before taking &(r2->cache_info)
Technically, we're not allowed to take the address of a member can't
exist relative to the null pointer. That makes me wonder how any sane
compliant system implements the offsetof macro, but let's let sleeping
balrogs lie.
Fixes 13096; patch on 0.1.1.9-alpha; patch from "teor", who was using
clang -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error -ftrapv
Diffstat (limited to 'src')
-rw-r--r-- | src/or/routerlist.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index b5e924522e..32cbe19379 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -4938,7 +4938,7 @@ routerlist_assert_ok(const routerlist_t *rl) } SMARTLIST_FOREACH_END(r); SMARTLIST_FOREACH_BEGIN(rl->old_routers, signed_descriptor_t *, sd) { r2 = rimap_get(rl->identity_map, sd->identity_digest); - tor_assert(sd != &(r2->cache_info)); + tor_assert(!r2 || sd != &(r2->cache_info)); sd2 = sdmap_get(rl->desc_digest_map, sd->signed_descriptor_digest); tor_assert(sd == sd2); tor_assert(sd->routerlist_index == sd_sl_idx); |