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

 
 

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

Submitted by:  Rafael Laboissiere <rlaboiss>
Submitted on:  Thu 12 Dec 2019 07:21:44 AM UTC  
 
Category:  Octave Forge 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

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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

Thanks, Markus.

Rafael Laboissiere <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>
Project Member
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 Laboissiere <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)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    No changes have been made to this item

    Back to the top


    Powered by Savane 3.5