bugGNU Octave - Bugs: bug #57396, [octave forge] (ocs) Compilation...

 
 

bug #57396: [octave forge] (ocs) Compilation failure

Submitter:  Rafael Laboissière <rlaboiss>
Submitted:  Thu 12 Dec 2019 07:21:44 AM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Build Failure
Status:  None Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * other Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 12 Dec 2019 04:29:44 PM UTC, comment #2: 

Thanks, Markus.

Rafael Laboissière <rlaboiss>
Thu 12 Dec 2019 03:43:54 PM UTC, comment #1: 

The easiest fix would probably be to provide a primitive format string:

warning ("%s", (string("Mshichmanhodgesmosfet: unknown parameter").append (parameternames[niter])).c_str ());


On an unrelated note: You might run into issues with the lifetime of the temporary string. I.e. the c_str pointer might be dereferenced by "warning" after the temporary string was already deleted. It's probably safer to assign it to a variable with well-defined scope:

string warn_string = string ("Mshichmanhodgesmosfet: unknown parameter").append (parameternames[niter]);
warning ("%s", warn_string.c_str ());


Markus Mützel <mmuetzel>
Group administrator
Thu 12 Dec 2019 07:21:44 AM UTC, original submission:  

Compilation of package ocs fails when -Werror=format-security (the default when building Debian packages, to avoid uncontrolled format string vulnerability):


mkoctfile Mshichmanhodgesmosfet.cc
Mshichmanhodgesmosfet.cc: In function ‘void set_parameters(ColumnVector, string_vector, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*, double*)’:
Mshichmanhodgesmosfet.cc:108:103: error: format not a string literal and no format arguments [-Werror=format-security]
  108 |  warning ((string("Mshichmanhodgesmosfet: unknown parameter").append (parameternames[niter])).c_str ());


Is there a simple way to fix this issue?

Rafael Laboissière <rlaboiss>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by rlaboiss (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-269c.
    Corresponding source code