[tor-bugs] #16400 [Tor]: Bug: Assertion cp failed in microdescs_parse_from_string at ../src/or/routerparse.c:4168
Tor Bug Tracker & Wiki
blackhole at torproject.org
Mon Jun 22 17:13:06 UTC 2015
#16400: Bug: Assertion cp failed in microdescs_parse_from_string at
../src/or/routerparse.c:4168
-------------------------+-------------------------------------------------
Reporter: torkeln | Owner:
Type: defect | Status: new
Priority: major | Milestone:
Component: Tor | Version: Tor: 0.2.6.9
Resolution: | Keywords: routerparse.c, assertion,
Actual Points: | 025-backport 026-backport
Points: | Parent ID:
-------------------------+-------------------------------------------------
Comment (by cypherpunks_backup):
Then, it should be ready for missed "onion-key" for every md.
{{{
--- routerparse.c 2015-04-06 13:30:54.000000000 +0000
+++ routerparse.c.edit 2015-06-22 17:04:52.489550356 +0000
@@ -4156,6 +4156,7 @@
while (s < eos) {
int okay = 0;
+ int digest_computed = 0;
start_of_next_microdesc = find_start_of_next_microdesc(s, eos);
if (!start_of_next_microdesc)
@@ -4165,8 +4166,10 @@
{
const char *cp = tor_memstr(s, start_of_next_microdesc-s,
"onion-key");
- tor_assert(cp);
-
+ if (!cp) {
+ log_fn(LOG_PROTOCOL_WARN, LD_DIR, "Malformed microdescriptor");
+ goto next;
+ }
md->bodylen = start_of_next_microdesc - cp;
md->saved_location = where;
if (copy_body)
@@ -4176,6 +4179,7 @@
md->off = cp - start;
}
crypto_digest256(md->digest, md->body, md->bodylen, DIGEST_SHA256);
+ digest_computed = 1;
if (tokenize_string(area, s, start_of_next_microdesc, tokens,
microdesc_token_table, flags)) {
@@ -4243,7 +4247,7 @@
md = NULL;
next:
- if (! okay && invalid_digests_out) {
+ if (! okay && invalid_digests_out && digest_computed) {
smartlist_add(invalid_digests_out,
tor_memdup(md->digest, DIGEST256_LEN));
}
}}}
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/16400#comment:11>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
More information about the tor-bugs
mailing list