[OpenSmalltalk/opensmalltalk-vm] 45c007: Avoid a signed int overflow (UB)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[OpenSmalltalk/opensmalltalk-vm] 45c007: Avoid a signed int overflow (UB)

Nicolas Cellier-4
 
  Branch: refs/heads/Cog
  Home:   https://github.com/OpenSmalltalk/opensmalltalk-vm
  Commit: 45c007445180ab0135a14b495f2dc9a76787bf54
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/45c007445180ab0135a14b495f2dc9a76787bf54
  Author: Nicolas Cellier <[hidden email]>
  Date:   2020-01-14 (Tue, 14 Jan 2020)

  Changed paths:
    M platforms/iOS/vm/OSX/SqViewClut.m.inc

  Log Message:
  -----------
  Avoid a signed int overflow (UB)

With compiler option: `-fsanitize=undefined`, we get:
> ../../platforms/iOS/vm/OSX/SqViewClut.m.inc:87:52: runtime error: left shift of 65280 by 16 places cannot be represented in type 'int'


  Commit: d7c138af4988df9fdd63d6796a938c3e84f45193
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/d7c138af4988df9fdd63d6796a938c3e84f45193
  Author: Nicolas Cellier <[hidden email]>
  Date:   2020-01-14 (Tue, 14 Jan 2020)

  Changed paths:
    M platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.m

  Log Message:
  -----------
  Avoid misaligned memory access

Compiler option `-fsanitize=undefined` reports:
../../platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.m:379:78: runtime error: load of misaligned address 0x0001035ede4b for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment


Compare: https://github.com/OpenSmalltalk/opensmalltalk-vm/compare/fc5a09861c05...d7c138af4988