On Sun, Aug 12, 2012 at 1:17 AM, Enlightenment SVN
<no-re...@enlightenment.org> wrote:
> Log:
> finally found evas_map weirdness bug. CEDRIC code...! commit #74180.
>
>   now here's the rub. from the glibc manual page:
>
>   ...
>          int memcmp(const void *s1, const void *s2, size_t n);
>
>   DESCRIPTION
>          The  memcmp()  function compares the first n bytes (each interpreted 
> as
>          unsigned char) of the memory areas s1 and s2.  It  returns  an 
> integer
>          less than, equal to, or greater than zero if s1 is found, 
> respectively,
>          to be less than, to match, or be greater than s2.
>
>   RETURN VALUE
>          The memcmp() function returns  an  integer  less  than, equal  to,  
> or
>          greater than zero if the first n bytes of s1 is found, respectively, 
> to
>          be less than, to match, or be greater than the first n bytes of s2.
>
>   ...
>
>   this explicitly says that s1 and s2 have their BYTES compared... and
>   then returns just some value < 0, 0 or > 0 based on the difference. what
>   that value is and means is not defined, as long as it is < 0, 0 or > 0.
>
>   so the C standard has this to say:
>
>   6.3.1.3 Signed and unsigned integers
>
>   2. Otherwise, if the new type is unsigned, the value is converted by
>   repeatedly adding or subtracting one more than the maximum value that
>   can be represented in the new type until the value is in the range of
>   the new type.
>
>   so a result of -255 (possible) is converted by REPEATEDLY adding the
>   max size of the new type (255) until within range... so ...
>   -255 + 255 = 0 ... within range.. BUT FALSE!
>
>   so why do we see this now? something changed in memcpy behavior.
>   before we ONLY saw values of -1, 0 or 1 - nothing else, NOW we see
>   thins like:
>
>   -12288
>   49152
>   4096
>   16384
>   61440
>   -53248
>
>   so memcpy changed behavior, though within specs of the manual page
>   anyway, but now the values can be ones that break the simple assignment.

there was a long discussion about this and MySQL or Kernel, I don't
recall which one it was, but was the same reason :-P


-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbi...@gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to