<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr">Le jeu. 27 déc. 2018 à 17:40, Alistair Grant <<a href="mailto:akgrant0710@gmail.com">akgrant0710@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br>
Hi Nicolas,<br>
<br>
On Thu, 27 Dec 2018 at 17:05, Nicolas Cellier<br>
<<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>> wrote:<br>
><br>
><br>
> Hi all,<br>
> while reviewing compiler warnings via MSVC for WIN-64 SPUR VM, I saw that we incorrectly pass a TCHAR * (via fromSqueak() function) to a function (isAccessiblePathName) expecting a WCHAR * (that is UTF-16 encoded wide char).<br>
><br>
> TCHAR is a facade, it might be char *, or it might be WCHAR *, depending on -DUNICODE compiler flag, or #define UNICODE preprocessor macro.<br>
><br>
> fromSqueak() just copies the image-side ByteString to a null terminated string. If -DUNICODE, it copies to a WCHAR *, but this only work for ASCII strings.<br>
><br>
> I suggest to rather interpret every path passed to the VM as UTF-8 encoded, and for that purpose I've committed a change to sqWin32Security.c.<br>
> <a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/b52caab76f7f6b91c1f16d9037e0b0a43d968176" rel="noreferrer" target="_blank">https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/b52caab76f7f6b91c1f16d9037e0b0a43d968176</a><br>
<br>
I actually thought this was what the VM always did, i.e. paths should<br>
be UTF-8 encoded in the image before being passed to a plugin.<br>
<br></blockquote></div><div class="gmail_quote">I agree, but apparently security plugin was left apart from these evolutions.</div><div class="gmail_quote">It's not a concern for Pharo, this plugin is only for sandboxing, I think mainly for E-toys.<br></div><div class="gmail_quote">I think that uptodate technics would be to use some kind of virtualization like thru Docker.<br></div><div class="gmail_quote"><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> But I see that other platforms flavours (unix at least) require the same kind of changes. Any thought before i proceeed?<br>
<br>
For Linux and Mac there is:<br>
<br>
- ux2sqPath(char *from, int fromLen, char *to, int toLen, int term)<br>
- sq2uxPath(char *from, int fromLen, char *to, int toLen, int term)<br>
<br>
On Mac this takes care of using the Mac specific decomposed UTF-8<br>
encoding required on that platform.  Both of these assume that the<br>
image is passing down (and receiving) a UTF-8 encoded string.  See<br>
platforms/unix/vm/sqUnixCharConv.h.<br>
<br>
<br>
Also, Tobias wrote a helper function for long file names on Windows:<br>
<br>
<a href="https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/476f70605a0352dd7528d251f7403e9233716cdb/platforms/win32/plugins/FilePlugin/sqWin32File.h#L33" rel="noreferrer" target="_blank">https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/476f70605a0352dd7528d251f7403e9233716cdb/platforms/win32/plugins/FilePlugin/sqWin32File.h#L33</a><br>
<br>
<br>
HTH,<br>
Alistair<br></blockquote><div><br></div><div>Thanks for the reminder, after an interrupt of a year or so, this will reduce the warm-up time ;)</div><div> <br></div></div></div>