pygame-community / pygame-ce

🐍🎮 pygame - Community Edition is a FOSS Python library for multimedia applications (like games). Built on top of the excellent SDL library.
https://pyga.me
914 stars 151 forks source link

`pygame.draw.aaline(⋯)` segfault for 24-bit surfaces #3075

Closed geometrian closed 1 month ago

geometrian commented 2 months ago

The following example causes a segfault (Python 3.12.5, pygame-ce 2.5.1):

import pygame

surf = pygame.Surface( (315,271), depth=24 )

#Crash on following line:
pygame.draw.aaline( surf, (255,0,255), (100,207),(20,229) )

Some coordinates can be passed safely, while others cannot. When it works, it seems to draw a line with the correct locations, but blended incorrectly. Meanwhile, 32-bit surfaces do not have this problem. This tells me that this function is not respecting the pixel stride.

damusss commented 2 months ago

I haven't looked at how or why, but I'm sure if you added the result of pygame.print_debug_info() to the PR description it would help contributors :)

bilhox commented 2 months ago

Hello,

Thanks for the report ! This is something we're already aware and I'm currently working on a fix, which should be available in the next pygame-ce version.

The PR in question : #3008