From: Kyle J. McKay Date: Tue, 22 Apr 2014 22:53:02 +0000 (-0700) Subject: ewah_bitmap.c: do not assume size_t and eword_t are the same size X-Git-Tag: v2.0.0-rc1~1^2 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/68f4e1fc6abd332726dd281c76dd63ce7d13d7a1?hp=68f4e1fc6abd332726dd281c76dd63ce7d13d7a1 ewah_bitmap.c: do not assume size_t and eword_t are the same size When buffer_grow changes the size of the buffer using realloc, it first computes and saves the rlw pointer's offset into the buffer using (uint8_t *) math before the realloc but then restores it using (eword_t *) math. In order to do this it's necessary to convert the (uint8_t *) offset into an (eword_t *) offset. It was doing this by dividing by the sizeof(size_t). Unfortunately sizeof(size_t) is not same as sizeof(eword_t) on all platforms. This causes illegal memory accesses and other bad things to happen when attempting to use bitmaps on those platforms. Fix this by dividing by the sizeof(eword_t) instead which will always be correct for all platforms. Signed-off-by: Kyle J. McKay Acked-by: Jeff King Signed-off-by: Junio C Hamano ---