Project

General

Profile

Bug #852927

Missing breaks in universal_value_from_str()

Added by Marko Lindqvist 7 months ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Category:
General
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

There's several cases where universal_value_from_str() lacks 'break;' if some conditional does not hold.

case VUT_aaa:
if (hopefully_true) {
return;
}
/* else. MISSING BREAK */
case VUT_bbb:


Related issues

Related to Freeciv - Feature #852929: Enable -Wimplicit-fallthroughIn Progress

History

#1 Updated by Marko Lindqvist 7 months ago

  • Status changed from New to In Progress
  • Target version set to 2.6.2

In S2_6 equivalent function is universal_by_rule_name() and it has just one break missing.

#3 Updated by Marko Lindqvist 7 months ago

#4 Updated by Jacob Nevins 7 months ago

In S2_6 equivalent function is universal_by_rule_name() and it has just one break missing.

The missing break is in case VUT_SPECIALIST, followed by VUT_MINSIZE.

I think it's mostly harmless: if a valid specialist name is supplied, we won't hit the bug. If an invalid specialist name is supplied, the function will still correctly fail, unless the invalid specialist name is numeric, in which case something worse will happen, probably a crash. (The server segfaulted when I tried it.)

So I think the effect is limited to "Specialist", "1", "Local" in a ruleset probably causing a crash on load, rather than a clean error (iff your ruleset isn't so weird as to have a specialist called "1").

I think S2_5 has the same bug.

I agree it's not worth holding up the next batch of releases for this.

#5 Updated by Marko Lindqvist 7 months ago

  • Status changed from Resolved to Closed
  • Assignee set to Marko Lindqvist

Also available in: Atom PDF