octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #55347] PVS studio static analysis report


From: Rik
Subject: [Octave-bug-tracker] [bug #55347] PVS studio static analysis report
Date: Mon, 7 Jan 2019 15:48:47 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Follow-up Comment #47, bug #55347 (project octave):

@jwe: Could you take a look at the really deep files like pt-eval.cc and
oct-stream.cc?

This one looks like maybe two wrongs make a right


oct-stream.cc (893)
        V764    Possible incorrect order of arguments passed to 
'process_conversion'
function: 'type' and 'modifier'.


The function call at 893 for printf_format_list is


process_conversion (s, i, n, args, flags, fw, prec,
                    type, modifier);


for which the function prototype is


    void process_conversion (const std::string& s, size_t& i, size_t n,
                             int& args, std::string& flags, int& fw,
                             int& prec, char& modifier, char& type);


The static analyzer was pretty sophisticated to catch that since it couldn't
rely on just type of argument as they are both 'char&'.  I think the reason
why it may work is that the other process_conversion functions in the same
file have the opposite ordering.  This is the
scanf_format_list::process_conversion prototype.


    void process_conversion (const std::string& s, size_t& i, size_t n,
                             int& width, bool& discard, char& type,
                             char& modifier);


My guess is that the printf_format_list function body has been coded to expect
"type", "modifier" ordering even thought the prototype is the other way
around. 


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?55347>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]