[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] 4a4a59: Fix a NULL pointer passed to memcpy

Nicolas Cellier noreply at github.com
Wed Sep 25 16:10:38 UTC 2019

  Branch: refs/heads/Cog
  Home:   https://github.com/OpenSmalltalk/opensmalltalk-vm
  Commit: 4a4a59309a1e07f9020c6d68f9506f1542b694d6
  Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
  Date:   2019-09-15 (Sun, 15 Sep 2019)

  Changed paths:
    M platforms/unix/vm-display-X11/sqUnixX11.c

  Log Message:
  Fix a NULL pointer passed to memcpy

Since we copy 0 bytes, this is benign, however the sanitizer barks
I used CC=clang ./mvm with added CFLAGS -fsanitize=undefined
> opensmalltalk/platforms/unix/vm-display-X11/sqUnixX11.c:1267:24: runtime error:
> null pointer passed as argument 2, which is declared to never be null
> /usr/include/string.h:43:28: note: nonnull attribute specified here

  Commit: 6b6e5da5cf127bb914c91af6301ca6f0aa4d2b08
  Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
  Date:   2019-09-25 (Wed, 25 Sep 2019)

  Changed paths:
    M platforms/iOS/plugins/SoundPlugin/sqSqueakSoundCoreAudio.m

  Log Message:
  Merge branch 'Cog' of github.com:OpenSmalltalk/opensmalltalk-vm into Cog

  Commit: 3023fbc2159243caf351b3aa9f02434c37fbaea5
  Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
  Date:   2019-09-25 (Wed, 25 Sep 2019)

  Changed paths:
    M platforms/unix/plugins/SocketPlugin/sqUnixSocket.c

  Log Message:
  Minor patch for making unix SocketPlugin 64bits friendly

IPV4 address are uint32_t, not u_long
This is not the same on 64 bits.
This has a consequence on alignment of pointer aliasing (u_long might require 8 bytes alignment).
This remove a runtime UndefinedBehavior sanitizer message (UBsan)
when compiled with CC=clang ./mvm and CFLAGS -fsanitize=undefined.
So far, the consequence are void, but let's not insult the future...

Note that I used autotools HAVE_STDINT_H for backward compatibility
but we could either drop this compatibility like already done in SSL or Camera plugin...
C99 is already 20years behind!

Also avoid converting a pointer (PSP) to (unsigned long) just for printing...
We have %p now for that purpose (like already used elsewhere in the same file).

Compare: https://github.com/OpenSmalltalk/opensmalltalk-vm/compare/521c75a86540...3023fbc21592

More information about the Vm-dev mailing list