Danek Duvall wrote:

> I ran into a problem with a perl test on sparc.  Looks like the code
> pulling keys out of a dict wasn't doing the right thing when it came to
> type declarations.
> 
> Basically, on a 64-bit big-endian machine like SPARC, size_t will be
> 64 bits, and I32 will be 32 bits.  If we pass the pointer to the 64-bit
> value off to a function that is expecting a 32-bit value, then the function
> will write the result (say, 3, as what happens in the test) into the lower
> end of the top half of the value:
> 
>     00 00 00 03 00 00 00 00
> 
> Back to the vim code, which interprets that memory again as a 64-bit value,
> and sees 12 billion or so, which is definitely greater than strlen(key), so
> we get the malformed key error.
> 
> On x86, this isn't a problem, since
> 
>     03 00 00 00 00 00 00 00
> 
> is interpreted as 3 regardless of whether the code thinks that's the start
> of a 64-bit value or a 32-bit value.  And in a 32-bit process, the
> endianness wouldn't matter since size_t would be 32-bits.
> 
> Patch is attached.

Thanks!  Casting a pointer is often a bad idea.


-- 
CONCORDE:  Quickly, sir, come this way!
LAUNCELOT: No!  It's not right for my idiom.  I must escape more  ... more ...
CONCORDE:  Dramatically, sir?
LAUNCELOT: Dramatically.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui