Merge pull request #2773 from cgohlke/patch-2

Fix bulletproof code from libc
This commit is contained in:
wiredfool 2017-10-02 09:23:24 +01:00 committed by GitHub
commit e4619d0ae5

View File

@ -430,8 +430,8 @@ ImagingAllocateArray(Imaging im, int dirty, int block_size)
im->blocks[current_block] = block;
/* Bulletproof code from libc _int_memalign */
aligned_ptr = (char *)(
((unsigned long) (block.ptr + arena->alignment - 1)) &
-((signed long) arena->alignment));
((size_t) (block.ptr + arena->alignment - 1)) &
-((Py_ssize_t) arena->alignment));
}
im->image[y] = aligned_ptr + aligned_linesize * line_in_block;