You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PConvert works for images of the same dimensions (width and height). However, blending images with different dimensions should return an error and not segfault. This causes issues for clients of the API (whether in Python or in C) where the program just segfaults.
The blend_images function should make a simple verification to the bottom and top images dimensions and check if they are equal. If not, we can return with an exit code. Notice that it already returns an ERROR_T (just an int) but it is always the NORMAL one unless it segfaults.
When images do not have the same size, this pointer arithmetic is guaranteed to SEGFAULT:
.zip will take both iterators and "fill" the shortest one with default values for the elements. Hence, if a smaller image is provided, this basically merges both by "aligning the shortest one to the top left" and using RGBA(0,0,0,0) for the filling.
@joamag
Description
PConvert works for images of the same dimensions (width and height). However, blending images with different dimensions should return an error and not segfault. This causes issues for clients of the API (whether in Python or in C) where the program just segfaults.
The
blend_images
function should make a simple verification to the bottom and top images dimensions and check if they are equal. If not, we can return with an exit code. Notice that it already returns an ERROR_T (just an int) but it is always the NORMAL one unless it segfaults.When images do not have the same size, this pointer arithmetic is guaranteed to SEGFAULT:
Proposal
Add an images dimensions check to all blend entry points to avoid invalid pointer arithmetic.
The text was updated successfully, but these errors were encountered: