30 January 2012

This is an approved src.alt for 436.cactusADM in CPU2006 v1.2.

This src.alt fixes calls to sprintf(3) which could result in undefined
behavior.  Specifically, several calls to sprintf() use the same character
array as both source and destination.  Per the C language standards, when
the source and destination objects overlap, the results are undefined.

In some run-time systems, the behavior was as the original programmer
intended; that is, the new string was appended to the destination.  In other
run-time systems, the destination was simply overwritten.  The latter case
caused output miscompares.

To apply the src.alt, unpack the tar file in the top level of the CPU2006
directory.  The following sequence of commands should accomplish this:

$ /bin/sh
$ cd <CPU2006 dir>
$ . ./shrc
$ go top
$ specxz -dc <src.alt tarball> | spectar -xvf -

Please replace the items in angle brackets ( <> ) as appropriate.

To have the src.alt applied during compilation, please add the following
stanza to your config file:

436.cactusADM:
srcalt=sprintf

This src.alt changes the affected calls so that the source is first copied to
a temporary array before calling sprintf().  These changes are
performance-neutral.

Please address any questions about this src.alt to cpu2006support@spec.org.
