[PD-dev] [ pure-data-Patches-1688540 ] fix makefilename segfault when wrong argument type received

SourceForge.net noreply at sourceforge.net
Mon Jul 30 01:50:22 CEST 2007


Patches item #1688540, was opened at 2007-03-26 09:33
Message generated for change (Comment added) made by millerpuckette
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=478072&aid=1688540&group_id=55736

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: Miller Puckette (millerpuckette)
Date: 2007-07-29 16: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 08: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&group_id=55736




More information about the Pd-dev mailing list