[PD] Pd-0.39-2 segmentation fault

IOhannes m zmoelnig zmoelnig at iem.at
Wed Sep 20 09:41:05 CEST 2006


Gerda Strobl wrote:
> Dear all,
> 
> I am using Pd version 0.39-2 on linux debian.
> 
> I wanted to produce using the makefilename object a symbol that contains
> a number and a symbol (123test.mtx), by giving the makefilename the
> wrong %%order my whole pd crashed immediately, producing a segmentation
> fault.

this is one of those "is it really a bug" bugreports.

assuming that [makefilename] is just an interface to a low level
C-string formatting, this behaviour is pretty much expected: you are
dealing with pointers (%s) which you are setting to a non-sense value (a
number) which is always a dangerous thing to do.
the relevant part in the help patch reads: 'If you put "%s" in the
string be sure to send it a symbol and vice versa... there's no checking.'
i guess no checking is done to keep the objects code trivial (i wouldn't
want to implement a type-checker for C format strings)


however, since [makefilename] is one of the few built-in objects that
allow a bit more sophisticated symbol generation, it could be argued
that this object should be made failsafe.

since the object is really primitive right now (you cannot have multiple
wildcards (list input!) except for special "lucky" cases), i would
suggest the latter.


the good news is, that you can do most of [makefilename]s functionality
with the extended super-cow features of the $-arg expansion in pd-0.40

e.g. the (non-existant) [makefilename %d-%s] (currently you have to
stack 2 [makefilename]s to get this) can be written as simple as [$1-$2(
however, if you want to do more formatting ("%05d") you still have to
use [makefilename]


mfg.adr.
IOhannes




More information about the Pd-list mailing list