[Pharo-project] new Cog VMs uploaded

Eliot Miranda eliot.miranda at gmail.com
Wed Apr 27 20:24:07 CEST 2011

Hi All,

    this is because of carelessness in the
trunk platforms/unix/plugins/LocalePlugin/sqUnixLocale.c which uses strcpy
to copy C strings from the locale subsystem into Smalltalk strings.  strcpy
copies the trailing null, which will overwrite the first byte of the
following object.  This just happens not to kill the standard VM because
current code always uses these functions on new strings.  But Cog currently
checks for attempts to overwrite objects and hence it catches these
attemptys and aborts, with an error message.

Hilaire, Phillipe, you should have seen and reported the "last object
overwritten" report form the VM and if so we would have debugged this a lot
sooner.  Error messages are there to be read.

Ian, David, I recommend that you fold

    Revision: 2382

back into trunk.

I've replaced all uses of strcpy
in platforms/unix/plugins/LocalePlugin/sqUnixLocale.c with the following:

/* For Cog do *not* copy the trailing null since the VM checks for attempts
 * overwrite the end of an object, and copying the trailing null into a
 * does precisely this.
#define safestrcpy(str,source) do { \
    char *src = (source); \
    int len = strlen(src); \
    strncpy(str,src,len); \
} while (0)

On Wed, Apr 27, 2011 at 8:18 AM, Philippe Marschall <kustos at gmx.net> wrote:

> On 26.04.2011 23:01, Eliot Miranda wrote:
> > ...to http://www.mirandabanda.org/files/Cog/VM/VM.r2379/.  These fix
> > shallowCopy and copyFrom: for contexts and (I hope) fix the linux Locale
> > plugin.
> The following still crashes my vm:
> (Locale localeID: (LocaleID isoLanguage: 'de' isoCountry: 'CH'))
> primShortDateFormat
> Cheers
> Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/pharo-project/attachments/20110427/bd3f9873/attachment.htm>

More information about the Pharo-project mailing list