Menu

Bug hunting: "Bad value: greater than 1" seems to be wrong when "1,2" is valid

versat
2020-02-11
2020-02-18
  • versat

    versat - 2020-02-11

    For this code:

        display_print_line(2U, p_line2);
    

    I get this warning:

    Id: bughuntingInvalidArgValue
    There is function call, cannot determine that 1st argument value is valid. Bad value: greater than 1
    

    The library configuration for this function looks like this:

      <function name="display_print_line">
        <noreturn>false</noreturn>
        <leak-ignore/>
        <arg nr="1">
          <not-uninit/>
          <not-bool/>
          <valid>1,2</valid>
        </arg>
        <arg nr="2">
          <not-null/>
          <not-uninit/>
          <not-bool/>
          <strz/>
        </arg>
      </function>
    

    So 1 and 2 are the only valid values. The message that the value is bad because it is greater than 1 looks wrong to me.

     
  • versat

    versat - 2020-02-18

    @danielmarjamaki What do you think?

     
  • Daniel Marjamäki

    you are right! do you have time to create a ticket?

     
  • versat

    versat - 2020-02-18

    Yes, I will create a ticket.

    EDIT:
    I created a ticket: https://trac.cppcheck.net/ticket/9642

     

    Last edit: versat 2020-02-18

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.