Branch: Tag:

2016-03-24

2016-03-24 14:20:07 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Nettle: The return value from crc32c() is unsigned.

Use push_int64() to avoid 32-bit signed integer overflows on
32-bit architectures.

Fixes Nettle.crc32c("123456789") returning -486108541
on 32-bit architectures.

555:   #ifdef HAVE_CRC32_INTRINSICS    if(supports_sse42)    { -  RETURN intel_crc32c((const unsigned int *)data->str, data->len); +  push_int64(intel_crc32c((const unsigned int *)data->str, data->len));    }    else   #endif /* HAVE_CRC32_INTRISINCS */
563:    unsigned int h=0xffffffff, i=0;    for(; i<data->len; i++)    h = (h>>8)^crc[(h^data->str[i])&0xFF]; -  RETURN h ^ 0xffffffff; +  push_int64(h ^ 0xffffffff);    }   }