[wesnoth-commits] [wesnoth/wesnoth] c5abf1: campaignd: Fix UB when servicing [request_campaign]

Iris Morelle noreply at github.com
Sat Feb 13 22:50:34 UTC 2021


  Branch: refs/heads/master
  Home:   https://github.com/wesnoth/wesnoth
  Commit: c5abf1bb00b8ee797d08182d44b604e990b2cd15
      https://github.com/wesnoth/wesnoth/commit/c5abf1bb00b8ee797d08182d44b604e990b2cd15
  Author: Iris Morelle <shadowm at wesnoth.org>
  Date:   2021-02-13 (Sat, 13 Feb 2021)

  Changed paths:
    M src/server/campaignd/server.cpp

  Log Message:
  -----------
  campaignd: Fix UB when servicing [request_campaign]

std::distance(A, B) requires A and B to be random access iterators if
the expression B < A is even expected to make any sense. std::map
produces bidirectional iterators instead, so this code was causing UB
when [request_campaign] was used with a From version newer than the To
version (a.k.a. downgrading an add-on).

This fix also allows us to skip a lot of nonsense in the event that From
== To.





More information about the Commits mailing list