Menu

#3262 Strange type conversions in compound assignments

Fixed_1.1.0
closed-fixed
nobody
None
5
2023-05-11
2022-05-22
wintertime
No

Hi,

I noticed there are some code scanning alerts from GitHub, which are there for a while already: https://github.com/FreeCol/freecol/security/code-scanning
They might indicate some uses of different types than were intended or unintended rounding/slicing.

Discussion

  • Mike Pope

    Mike Pope - 2022-05-23

    Checked them. Five of them are places where the AI is scoring some potential course of action, so the failure mode of integer overflow is: The AI behaves suboptimally

    One of them is in OggVorbisDecoderFactory, where we are being stuffed around by the skip method that has to inherit the long skip(long) signature from InputStream, despite all other IO being done in int-quantities. The line that generates a warning is below a test where the long variable is is tested to be less than an integer variable, so that warning is a false positive.

    Nevertheless, in an attempt to keep github happy, git.ede2647. Prediction, github starts whining about the explicit narrowing casts I just added.

     
  • Stian Grenborgen

    • status: open --> closed-fixed
    • Group: Current --> Fixed_trunk
     
  • Stian Grenborgen

    • Group: Fixed_trunk --> Fixed_1.1.0
     

Log in to post a comment.