Patches item #1688540, was opened at 2007-03-26 12:33 Message generated for change (Comment added) made by eighthave You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1688540...
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: puredata Group: bugfix Status: Open Resolution: None Priority: 5 Private: No Submitted By: Stephen Sinclair (radarsat1) Assigned to: Miller Puckette (millerpuckette) Summary: fix makefilename segfault when wrong argument type received
Initial Comment: Currently, Pd segfaults if the "makefilename" object is configured to receive a symbol ("%s") and it receives a float argument.
This patch uses strstr() to check if the sprintf string is going to accept a float, like so:
strstr(s->s_name, "%s")==0
The result is saved in the t_makefilename structure. It is recalculated on the "set" message.
When the wrong message type is received, a 0 or "" string is substituted, respectfully.
While it is unfortunate to do a string search like this, it is not very good to have Pd segfaulting, so I see no alternative.
----------------------------------------------------------------------
Comment By: Hans-Christoph Steiner (eighthave)
Date: 2007-07-30 21:04
Message: Logged In: YES user_id=27104 Originator: NO
Does this new patch replace pd-cvs-makefilename-20070326.patch? If so, pd-cvs-makefilename-20070326.patch should be deleted from this tracker.
I committed it to packages/patches so it'll be automatically included in the Pd-0.40.3-extended nightly builds.
----------------------------------------------------------------------
Comment By: Stephen Sinclair (radarsat1) Date: 2007-07-30 14:23
Message: Logged In: YES user_id=616837 Originator: YES
Attached is a more complete patch scanning the symbol argument more thoroughly for sprintf-compatible formatting. Also now differentiates between float and int arguments, and supports format flags. Could probably be extended to support multiple arguments.
This patch also stops makefilename from spitting out (null) symbols.
Patch generated with "diff -uw x_connective.c"
File Added: makefilename_scanformat.patch
----------------------------------------------------------------------
Comment By: Stephen Sinclair (radarsat1) Date: 2007-07-30 14:19
Message: Logged In: YES user_id=616837 Originator: YES
File Added: makefilename_crash.pd
----------------------------------------------------------------------
Comment By: Miller Puckette (millerpuckette) Date: 2007-07-29 19:50
Message: Logged In: YES user_id=313747 Originator: NO
It would take more work to do it right: check that there's only one "%f" and no "%s" or vice versa, and further check for "%%f", etc... I figure on doing this someday if nobody else does.
----------------------------------------------------------------------
Comment By: Hans-Christoph Steiner (eighthave) Date: 2007-06-14 11:11
Message: Logged In: YES user_id=27104 Originator: NO
I applied this patch to the Pd-0.39.2-extended branch and it failed to compile:
x_connective.c: In function 'makefilename_new': x_connective.c:1213: error: 'struct _makefilename' has no member named 'x_accept_float' x_connective.c: In function 'makefilename_float': x_connective.c:1219: error: 'struct _makefilename' has no member named 'x_accept_float' x_connective.c: In function 'makefilename_symbol': x_connective.c:1229: error: 'struct _makefilename' has no member named 'x_accept_float' x_connective.c: In function 'makefilename_set': x_connective.c:1239: error: 'struct _makefilename' has no member named 'x_accept_float'
My guess is that the patch needs to be a "diff -uw" format, which is much better at dealing with different line numbers, etc.
Also, an example patch to demonstrate the bug is always useful.
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1688540...