From: Arnaud Giersch Date: Tue, 6 Feb 2018 15:51:33 +0000 (+0100) Subject: Inform scan-build that (bucket_id + i) cannot wrap around. X-Git-Tag: v3.19~244^2~4 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/14b4aae8c332b6cfcb58188a76f5a68b1aab97ea Inform scan-build that (bucket_id + i) cannot wrap around. --- diff --git a/examples/s4u/dht-kademlia/node.cpp b/examples/s4u/dht-kademlia/node.cpp index 2bdd570b71..b5e10fec82 100644 --- a/examples/s4u/dht-kademlia/node.cpp +++ b/examples/s4u/dht-kademlia/node.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010, 2012-2017. The SimGrid Team. +/* Copyright (c) 2010, 2012-2018. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -59,6 +59,7 @@ bool Node::join(unsigned int known_id) /* Second step: Send a FIND_NODE to a a random node in buckets */ unsigned int bucket_id = table->findBucket(known_id)->getId(); + xbt_assert(bucket_id <= identifier_size); for (i = 0; ((bucket_id > i) || (bucket_id + i) <= identifier_size) && i < JOIN_BUCKETS_QUERIES; i++) { if (bucket_id > i) { unsigned int id_in_bucket = get_id_in_prefix(id_, bucket_id - i);