10 March 2026

This is an approved src.alt for 507.cactuBSSN_r and 607.cactuBSSN_s in
SPEC CPU 2017 v1.1.x.

This src.alt fixes calls to sprintf(3) which could result in undefined
behavior or memory corruption.  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.

Additionally, even in cases where the copying behavior was as intended,
the data written could exceed the size of the destination buffer. On
some systems, this can cause the benchmark to crash.

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

$ /bin/sh
$ cd <CPU2017 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:

  507.cactuBSSN_r,607.cactuBSSN_s:
  srcalt = snprintf

This src.alt changes the affected calls from a sequence of sprintf() calls
to snprintf() calls that fill a temporary buffer which is accumulated into
the destination using strncat().

These changes are performance-neutral.

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