Yes, that is what I was trying to say: length 15 and length 16 were both wrong. There were two mistakes: the buffer overflow, and the non-compatible types and printf-strings. Fixing the latter one (which resulted in 16 characters on 64-bit platforms, where C++ "long" is 64-bit) makes the former one (the 15 characters) irrelevant. The patch prints at most 4 (integer) or 8 (long) characters.<br>
The integer and long in LibreOffice Basic are described here: <a href="http://help.libreoffice.org/Basic/Using_Variables#Integer_Variables">http://help.libreoffice.org/Basic/Using_Variables#Integer_Variables</a><br>Microsoft Visual Basic uses double sizes (4 and 8 bytes): <a href="http://msdn.microsoft.com/en-US/library/47zceaw7%28v=vs.110%29">http://msdn.microsoft.com/en-US/library/47zceaw7%28v=vs.110%29</a><br>
<br>Uray M. János<br><br><div class="gmail_quote">On Tue, Jul 31, 2012 at 11:08 AM, Noel Power <span dir="ltr"><<a href="mailto:nopower@suse.com" target="_blank">nopower@suse.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 31/07/12 07:13, János Uray wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The patch solves this bug: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=42492" target="_blank">https://bugs.freedesktop.org/<u></u>show_bug.cgi?id=42492</a><br>
There was a buffer overflow: char aBuffer[16] had no room for the terminating null character.<br>
But the hex command was still wrong, because the printf used "%X" and "%lX", which are very platform-dependent.<br>
Actually the "integer" is only 16-bit, and "long" is only 32-bit. I've corrected this by using "%"SAL_PRIXUINT32 as described in <a href="http://wiki.documentfoundation.org/Development/Sal_Types" target="_blank">http://wiki.<u></u>documentfoundation.org/<u></u>Development/Sal_Types</a> (and there is no SAL_PRIXUINT16, so both were converted to sal_uInt32).<br>
</blockquote></div></div>
hmm, not looking at the patch in detail yet I am not sure if a length of 16 is sensible, if the size of the type for the hex output is 2 (integer) or 4 bytes (long) I would expect the max display from HEX to be FFFF or FFFFFFFF respectively :/ I'd like to see what MS vba does here, we should try to remain compatible if possible.<span class="HOEnZb"><font color="#888888"><br>
<br>
Noel<br>
</font></span></blockquote></div><br>