forked from pygame/pygame
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix undefined behavior in pixel get/set routines
The unit tests only seem to exercise the UB in set_pixel_color, but I believe the same issue is present in get_pixel_color. There is no guarantee that the incoming pixel buffer is aligned, so casting it to a larger integer with alignment requirements can issue an unaligned load. I've unified and simplified the LE/BE implementation divergence as much as possible. memcpy() should compile to roughly the same asm as a direct assignment. Tested on LE and BE. Should fix pygame#1313
- Loading branch information
Showing
1 changed file
with
38 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters