[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] 4b2364: Protect buffer underflow
GitHub
noreply at github.com
Sat Dec 29 14:12:47 UTC 2018
Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: 4b23645c1ccff7cbd4d8bb8e01fb950efd295ad2
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/4b23645c1ccff7cbd4d8bb8e01fb950efd295ad2
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-25 (Tue, 25 Dec 2018)
Changed paths:
M platforms/win32/vm/sqWin32Directory.c
Log Message:
-----------
Protect buffer underflow
Path could be shorted than 4 chars eventually...
Commit: e9bfeefc03b7a908b2925a9c474a59b9b9ad7d1b
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/e9bfeefc03b7a908b2925a9c474a59b9b9ad7d1b
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-25 (Tue, 25 Dec 2018)
Changed paths:
M platforms/win32/plugins/HostWindowPlugin/sqWin32HostWindowPlugin.c
Log Message:
-----------
Make icon setting 64bits compatible
Casting the icon handle (size of a pointer) to LONG (32 bits) is not 64bits friendly
Commit: 8df05ee8a333d24e76d7956a9ef4d73bd120b4bb
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/8df05ee8a333d24e76d7956a9ef4d73bd120b4bb
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-25 (Tue, 25 Dec 2018)
Changed paths:
M platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c
Log Message:
-----------
remove a warning about a control path not returning a value
Commit: b2a8bd8d8beddebbcb128c5b39740e8a94c16763
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/b2a8bd8d8beddebbcb128c5b39740e8a94c16763
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-25 (Tue, 25 Dec 2018)
Changed paths:
M platforms/win32/plugins/SqueakSSL/sqWin32SSL.c
Log Message:
-----------
Use TEXT macro for generic (ASCII or WIDE) string method
We should either use
- explicit ASCII variant with ASCII String constant `CertOpenSystemStoreA(0 , "MY")`
- explicit WIDE variant with Wide String constant `CertOpenSystemStoreW(0 , L"MY")`
- generic variant with generic TEXT constant `CertOpenSystemStore(0 , TEXT("MY"))`
But we should not mix usage of whatever variant function with whatever variant String.<br>
See https://docs.microsoft.com/en-us/windows/desktop/api/winnt/nf-winnt-text
Otherwise, in absence of `-DUNICODE`compiler flag, the compiler barks:
../../platforms/win32/plugins/SqueakSSL/sqWin32SSL.c:176:35: warning: incompatible pointer types passing 'unsigned short [3]' to parameter of type 'LPCSTR' (aka 'const char *') [-Wincompatible-pointer-types]
hStore = CertOpenSystemStore(0, L"MY");
^~~~~
/usr/x86_64-w64-mingw32/sys-root/mingw/include/wincrypt.h:4432:83: note: passing argument to parameter 'szSubsystemProtocol' here
WINIMPM HCERTSTORE WINAPI CertOpenSystemStoreA (HCRYPTPROV_LEGACY hProv, LPCSTR szSubsystemProtocol);
Commit: a08c1fec2bd75375e5c389eb5e0b706eaa62c82f
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/a08c1fec2bd75375e5c389eb5e0b706eaa62c82f
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-26 (Wed, 26 Dec 2018)
Changed paths:
M platforms/win32/vm/sqWin32Heartbeat.c
Log Message:
-----------
Provides a high resolution clock for MSVC
See https://msdn.microsoft.com/en-us/library/ms644904(v=VS.85).aspx
Commit: 57d09aebf6b45f6b2cce6659f70946e8c9a38d2c
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/57d09aebf6b45f6b2cce6659f70946e8c9a38d2c
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-26 (Wed, 26 Dec 2018)
Changed paths:
M platforms/win32/vm/sqWin32Directory.c
Log Message:
-----------
Define some UNIX constants in sqWin32Directory.c, MSVC oblige
the unix constants S_IRUSR are not defined in MSVC.
Pick the workaround from platforms/minheadless/windows/sqWin32Directory.c
Commit: ad71bd01659a5b909a2f744361a660c6a53a00b3
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/ad71bd01659a5b909a2f744361a660c6a53a00b3
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-26 (Wed, 26 Dec 2018)
Changed paths:
M platforms/win32/plugins/SqueakSSL/sqWin32SSL.c
Log Message:
-----------
Remove a few printf warnings
Commit: 8c04d9af6c308207399849a516aaf91d1b5f33e8
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/8c04d9af6c308207399849a516aaf91d1b5f33e8
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-26 (Wed, 26 Dec 2018)
Changed paths:
M platforms/win32/vm/sqWin32DirectInput.c
Log Message:
-----------
Prefer DirectX8 in MSVC
Note that support for DirectX-7 is not available after 2007 SDK!!!
https://blogs.msdn.microsoft.com/chuckw/2012/08/21/directx-sdks-of-a-certain-age/
We are showing our age...
cygwin still provide support files for DirectX-7, but DirectX-8 does not compile out of the box, so stick to 7 outside MSVC.
Commit: e0d70a91864eca8f72947fe36d1865785482ed2e
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/e0d70a91864eca8f72947fe36d1865785482ed2e
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-27 (Thu, 27 Dec 2018)
Changed paths:
M platforms/Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c
Log Message:
-----------
Workaround S_ISFIFO to let MSVC compile FilePlugin
Note: there is a possibility to create named pipe in windows
https://docs.microsoft.com/en-us/windows/desktop/ipc/named-pipes
But named pipes cannot be intermixed with regular files.
They are mounted on special named pipe file system (NPFS)
https://stackoverflow.com/questions/21139790/where-on-windows-a-named-pipe-file-is-stored
So I think that answering false to the query is a good solution.
Commit: 9aea67d0dd63a191e80f69c6e760aadaf72de763
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/9aea67d0dd63a191e80f69c6e760aadaf72de763
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-27 (Thu, 27 Dec 2018)
Changed paths:
M platforms/win32/vm/sqWin32Backtrace.c
M platforms/win32/vm/sqWin32Threads.c
Log Message:
-----------
Backport Unicode compatibility patches from minheadless variant
Commit: f6d2d56b091be1b25310128b228c48c968114d60
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/f6d2d56b091be1b25310128b228c48c968114d60
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-27 (Thu, 27 Dec 2018)
Changed paths:
M platforms/win32/plugins/SoundPlugin/sqWin32Sound.c
Log Message:
-----------
Yet another printLastError Unicode compatibility fix in SoundPlugin
Commit: 67980fcf86460ac508b2beaf4a39cef58040ccdf
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/67980fcf86460ac508b2beaf4a39cef58040ccdf
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-27 (Thu, 27 Dec 2018)
Changed paths:
M platforms/win32/vm/sqWin32PluginSupport.c
M platforms/win32/vm/sqWin32Threads.c
M platforms/win32/vm/sqWin32Window.c
Log Message:
-----------
Fix another bunch of usage of printLastError uncompatible with Unicode
Commit: b52caab76f7f6b91c1f16d9037e0b0a43d968176
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/b52caab76f7f6b91c1f16d9037e0b0a43d968176
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-27 (Thu, 27 Dec 2018)
Changed paths:
M platforms/win32/plugins/SecurityPlugin/sqWin32Security.c
Log Message:
-----------
Fix sqWin32Security.c UNICODE problems
We cannot pass a TCHAR * to a function expecting a WCHAR *, or the compiler logically barks.
`isAccessiblePathName` takes a WCHAR * parameter
`fromSqueak` answers a TCHAR *, which is currently a char * (because UNICODE is undefined).
We want to be able to query internationalized path name, then the best (portable) thing to do is stick to UTF-8.
We thus now interpret the pathName/fileName as UTF8-encoded in the authorization query primitives.
NOTE: no effort is attempted to handle long path names here.
Commit: 28cf9c626ee5eb0fce7bad34b8a87753fd974417
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/28cf9c626ee5eb0fce7bad34b8a87753fd974417
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-27 (Thu, 27 Dec 2018)
Changed paths:
M platforms/win32/vm/sqWin32Window.c
Log Message:
-----------
Fix TEXT(VMOPTION('foo"))
TEXT is a macro that prepend a L, like TEXT("foo") => L"foo".
It does not work for concatenated constants: TEXT("foo" "bar") => L"foo" "bar".
VMOPTION concatenates a "-".
Therefore we need a specific TVMOPTION macro.
Commit: 9e82899e688d01935a7157b27fa885329e98d143
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/9e82899e688d01935a7157b27fa885329e98d143
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-27 (Thu, 27 Dec 2018)
Changed paths:
M platforms/win32/plugins/HostWindowPlugin/sqWin32HostWindowPlugin.c
M platforms/win32/vm/sqWin32Window.c
Log Message:
-----------
Concatenate TEXT constants rather than TEXT concatenated constants
TEXT("foo" "bar") => L"foo" "bar" => error concatenating wide string and ascii string
TEXT("foo") TEXT("bar") => L"foo" L"bar" => compile OK
Commit: 4e947dac58a702889adb281377708f897b0fc8c4
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/4e947dac58a702889adb281377708f897b0fc8c4
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-27 (Thu, 27 Dec 2018)
Changed paths:
M platforms/win32/plugins/SoundPlugin/sqWin32Sound.c
M platforms/win32/vm/sqWin32Alloc.c
M platforms/win32/vm/sqWin32PluginSupport.c
Log Message:
-----------
printLastError & warnPrintf take a TCHAR *, not a char *
Commit: 3227fcf750b035281697da052df88f60b5c391d6
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/3227fcf750b035281697da052df88f60b5c391d6
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-27 (Thu, 27 Dec 2018)
Changed paths:
M platforms/win32/plugins/SoundPlugin/sqWin32Sound.c
Log Message:
-----------
DPRINTF takes a TCHAR * when it is a warnPrintf in disguise
thus, it requires usage of a TEXT macro to enable -DUNICODE compilation
Commit: 8d44470f37b62c5c0519cf9c5ae5349ec320582e
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/8d44470f37b62c5c0519cf9c5ae5349ec320582e
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-28 (Fri, 28 Dec 2018)
Changed paths:
M platforms/win32/vm/sqWin32Window.c
Log Message:
-----------
Splash file and title may use Unicode variant
We could also have used GetPrivateProfileStringA as a workaround, but let's not insult the future (internationalization)
Commit: 0eeffa0d7e337e92b0f01dcd74698667c168d835
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/0eeffa0d7e337e92b0f01dcd74698667c168d835
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-28 (Fri, 28 Dec 2018)
Changed paths:
M platforms/win32/vm/sqWin32.h
M platforms/win32/vm/sqWin32Prefs.c
M platforms/win32/vm/sqWin32Window.c
Log Message:
-----------
windowTitle is not a TCHAR *, it is a UTF8 encoded char *
Commit: 3d55c5d4a6396772719230fc56e5b11b7faafe0b
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/3d55c5d4a6396772719230fc56e5b11b7faafe0b
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-28 (Fri, 28 Dec 2018)
Changed paths:
M platforms/win32/plugins/B3DAcceleratorPlugin/sqWin32OpenGL.c
Log Message:
-----------
make win23OpenGL UNICODE friendly
CreateWindow is the generic call that can switch to CreateWindowA or CreateWindowW
It must take TCHAR * arguments.
Commit: 001d21af530cfd2255e43d4f20b3df84ac735cbe
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/001d21af530cfd2255e43d4f20b3df84ac735cbe
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-28 (Fri, 28 Dec 2018)
Changed paths:
M platforms/win32/plugins/CroquetPlugin/sqWin32CroquetPlugin.c
M platforms/win32/vm/sqWin32Main.c
Log Message:
-----------
Invoke LoadLibraryA when there's no point to internationalize library name
Most library names are dumb ASCII strings, so encoding them in UTF-16 has no added value.
Commit: 616cacb0048b76385e265230406782db341e4a98
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/616cacb0048b76385e265230406782db341e4a98
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-28 (Fri, 28 Dec 2018)
Changed paths:
M platforms/win32/vm/sqWin32ExternalPrims.c
Log Message:
-----------
GetProcAddress takes simple byte string procedure name
Until now, there's no such thing as internationalized procedure names.
Probably because low level languages do not support non ASCII identifiers.
Commit: 4b328037903d7eb1b9e0da5ef325693040831c4a
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/4b328037903d7eb1b9e0da5ef325693040831c4a
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-28 (Fri, 28 Dec 2018)
Changed paths:
M platforms/win32/plugins/LocalePlugin/sqWin32Locale.c
Log Message:
-----------
Use GetLocaleInfoA rather than generic version
This is the least change that makes the plugin compile correctly with -DUNICODE
But this is maybe not the right thing.
If the answer contains a character that is not available in the code page,
then it will be replaced by a question mark.
https://docs.microsoft.com/en-us/windows/desktop/api/winnls/nf-winnls-getlocaleinfow
The right thing would be to go thru GetLocaleInfoW and WideCharToMultiByte dance to answer an UTF-8 encoded string.
Commit: 539c7692dee3292456301dfb14b8a36513a9cc76
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/539c7692dee3292456301dfb14b8a36513a9cc76
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-28 (Fri, 28 Dec 2018)
Changed paths:
M platforms/win32/vm/sqWin32Window.c
Log Message:
-----------
remove unused LongFileNameFromPossiblyShortName
This might be a nice piece of code, but it's dead code.
Dead code has maintenance costs that generally do not pay back.
For example when reviewing UNICODE compatibility, I just paid for what I did not buy.
For archeology purposes, there is a source code/version control system.
Commit: 7c5fe91432e72fdcc6a7e098818a8bcfccb3371f
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/7c5fe91432e72fdcc6a7e098818a8bcfccb3371f
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-28 (Fri, 28 Dec 2018)
Changed paths:
M platforms/win32/vm/sqWin32PluginSupport.c
Log Message:
-----------
the DPRINTF used in sqWin32PluginSupport.c takes a TCHAR *, not a char *
It's hard to decipher, because DPRINTF is both:
- a MACRO at top of this file (and in many other files just to shuffle the cards)
- a function in sqWin32Main.c
Since the MACRO looks like recursive, it's a kind of dangerously convoluted code!
Commit: 19ebd67cbadb77088bec9e4bc2da28c6889251b7
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/19ebd67cbadb77088bec9e4bc2da28c6889251b7
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-29 (Sat, 29 Dec 2018)
Changed paths:
M platforms/win32/vm/sqWin32Prefs.c
Log Message:
-----------
Handle failure to convert WindowTitle preference to UTF8
Commit: 8f731e5896e819c831636e9a3ac74132f40f72f9
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/8f731e5896e819c831636e9a3ac74132f40f72f9
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2018-12-29 (Sat, 29 Dec 2018)
Changed paths:
M platforms/Cross/plugins/B3DAcceleratorPlugin/sqOpenGLRenderer.c
M platforms/Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c
M platforms/win32/plugins/B3DAcceleratorPlugin/sqWin32OpenGL.c
M platforms/win32/plugins/CroquetPlugin/sqWin32CroquetPlugin.c
M platforms/win32/plugins/HostWindowPlugin/sqWin32HostWindowPlugin.c
M platforms/win32/plugins/LocalePlugin/sqWin32Locale.c
M platforms/win32/plugins/SecurityPlugin/sqWin32Security.c
M platforms/win32/plugins/SoundPlugin/sqWin32Sound.c
M platforms/win32/plugins/SqueakSSL/sqWin32SSL.c
M platforms/win32/vm/sqWin32.h
M platforms/win32/vm/sqWin32Alloc.c
M platforms/win32/vm/sqWin32Backtrace.c
M platforms/win32/vm/sqWin32DirectInput.c
M platforms/win32/vm/sqWin32Directory.c
M platforms/win32/vm/sqWin32ExternalPrims.c
M platforms/win32/vm/sqWin32Heartbeat.c
M platforms/win32/vm/sqWin32Main.c
M platforms/win32/vm/sqWin32PluginSupport.c
M platforms/win32/vm/sqWin32Prefs.c
M platforms/win32/vm/sqWin32Threads.c
M platforms/win32/vm/sqWin32Window.c
Log Message:
-----------
Merge pull request #329 from OpenSmalltalk/win64_cleanups
Win64 platform code sanitizing and cleanups
Compare: https://github.com/OpenSmalltalk/opensmalltalk-vm/compare/968ed91bdf3a...8f731e5896e8
**NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/
Functionality will be removed from GitHub.com on January 31st, 2019.
More information about the Vm-dev
mailing list