fix possible division by 0

This commit is contained in:
Vincent Torri 2023-09-29 04:18:17 +02:00 committed by Gitea
parent 4b443e752f
commit 0d13612a27
1 changed files with 3 additions and 0 deletions

View File

@ -116,6 +116,9 @@ save_image_qoi(RGBA_Image *im, const char *file, int quality EINA_UNUSED)
for (px_pos = 0; px_pos < px_len; px_pos += channels, iter +=4)
{
px.rgba.a = *(iter + 3);
if (px.rgba.a == 0)
goto close_f;
px.rgba.b = *(iter + 0) * 255 / px.rgba.a;
px.rgba.g = *(iter + 1) * 255 / px.rgba.a;
px.rgba.r = *(iter + 2) * 255 / px.rgba.a;