Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[pvs] The 'gw_src' pointer was utilized before it was verified against nullptr.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 25 Nov 2020 21:26:44 +0000 (22:26 +0100)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 25 Nov 2020 21:26:44 +0000 (22:26 +0100)
src/kernel/routing/FloydZone.cpp
src/kernel/routing/FullZone.cpp

index c414f96..111355c 100644 (file)
@@ -96,7 +96,7 @@ void FloydZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoi
   add_route_check_params(src, dst, gw_src, gw_dst, link_list, symmetrical);
 
   /* Check that the route does not already exist */
-  if (gw_dst) // netzone route (to adapt the error message, if any)
+  if (gw_dst && gw_src) // netzone route (to adapt the error message, if any)
     xbt_assert(nullptr == TO_FLOYD_LINK(src->id(), dst->id()),
                "The route between %s@%s and %s@%s already exists (Rq: routes are symmetrical by default).",
                src->get_cname(), gw_src->get_cname(), dst->get_cname(), gw_dst->get_cname());
@@ -110,7 +110,7 @@ void FloydZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoi
   TO_FLOYD_COST(src->id(), dst->id()) = (TO_FLOYD_LINK(src->id(), dst->id()))->link_list.size();
 
   if (symmetrical) {
-    if (gw_dst) // netzone route (to adapt the error message, if any)
+    if (gw_dst && gw_src) // netzone route (to adapt the error message, if any)
       xbt_assert(
           nullptr == TO_FLOYD_LINK(dst->id(), src->id()),
           "The route between %s@%s and %s@%s already exists. You should not declare the reverse path as symmetrical.",
index 1defdac..c6273b6 100644 (file)
@@ -78,7 +78,7 @@ void FullZone::add_route(NetPoint* src, NetPoint* dst, NetPoint* gw_src, NetPoin
     routing_table_.resize(table_size * table_size, nullptr);
 
   /* Check that the route does not already exist */
-  if (gw_dst) // inter-zone route (to adapt the error message, if any)
+  if (gw_dst && gw_src) // inter-zone route (to adapt the error message, if any)
     xbt_assert(nullptr == TO_ROUTE_FULL(src->id(), dst->id()),
                "The route between %s@%s and %s@%s already exists (Rq: routes are symmetrical by default).",
                src->get_cname(), gw_src->get_cname(), dst->get_cname(), gw_dst->get_cname());