Skip to content

Commit

Permalink
eel-gdk-pixbuf-extensions: Fix division by zero
Browse files Browse the repository at this point in the history
Fixes Clang static analyzer warning:

eel-gdk-pixbuf-extensions.c:403:29: warning: Division by zero
                *dest++ = r / n_pixels;
                          ~~^~~~~~~~~~
  • Loading branch information
sc0w committed Mar 6, 2019
1 parent 6e6c9c6 commit 601c853
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions eel/eel-gdk-pixbuf-extensions.c
Expand Up @@ -400,9 +400,18 @@ eel_gdk_pixbuf_scale_down (GdkPixbuf *pixbuf,
}
else
{
*dest++ = r / n_pixels;
*dest++ = g / n_pixels;
*dest++ = b / n_pixels;
if (n_pixels != 0)
{
*dest++ = r / n_pixels;
*dest++ = g / n_pixels;
*dest++ = b / n_pixels;
}
else
{
*dest++ = 0;
*dest++ = 0;
*dest++ = 0;
}
}

s_x1 = s_x2;
Expand Down

0 comments on commit 601c853

Please sign in to comment.