#888 Format string bug in SWIG_Python_AddErrorMsg

closed-fixed
nobody
python (259)
5
2008-02-01
2008-01-29
Ben Pfaff
No

The SWIG_Python_AddErrorMsg function in Lib/python/pyerrors.swg invokes PyErr_Format as follows:
PyErr_Format(PyExc_RuntimeError, mesg);
PyErr_Format in turn treats its second argument as a printf-style format string. I believe that this is a bug and that this code should be written as:
PyErr_Format(PyExc_RuntimeError, "%s", mesg);
or
PyErr_SetString(PyExc_RuntimeError, mesg);

Discussion

  • Olly Betts

    Olly Betts - 2008-02-01

    Logged In: YES
    user_id=14972
    Originator: NO

    Yes, that's clearly not right. Fixed in SVN HEAD to use PyErr_SetString(). Thanks.

     
  • Olly Betts

    Olly Betts - 2008-02-01
    • status: open --> closed-fixed
     

Log in to post a comment.