[Vm-dev] Three commits for review

monty monty2 at programmer.net
Tue May 9 23:14:41 UTC 2017


I split my large commit from a while back into three smaller ones as requested, to be applied with `git am`.

buffer-overflow-fix.patch

This fixes buffer overflows in sqUnixFile.c using safer string functions adapted from BSD's strlcpy() and strlcat() and modernizes the #includes to assume a POSIX environment.

race-condition-fix.patch

This fixes race conditions in sqFileOpen() that could cause accidental file truncation and data loss while still preserving the existing semantics of trying to open the file in increasingly restricted modes after each failure.

It also adds sqFileOpenNew() (to support a new primitive), which opens a new file atomically, failing if it already exists. This is essential (along with fsync and rename) for doing durable file IO from Squeak and Pharo. The Windows part could use review.

The isatty() part that zecke said looked "fishy" is just dead code elimination, removing the `#if 0` branch of an #if/#else/#endif. (There's a larger chunk of dead code above that I left, after the `#if defined(_IOLBF) && 0`)

char-conv-fix.patch

This just replaces the complex function generating macros with their output (`gcc -E`) to improve identifier searchability.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: buffer-overflow-fix.patch
Type: text/x-patch
Size: 22523 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20170510/917fb8b4/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: char-conv-fix.patch
Type: text/x-patch
Size: 3386 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20170510/917fb8b4/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: race-condition-fix.patch
Type: text/x-patch
Size: 18882 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20170510/917fb8b4/attachment-0005.bin>


More information about the Vm-dev mailing list