[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

divide-by-zero during redisplay

From: Miles Bader
Subject: divide-by-zero during redisplay
Date: Mon, 26 May 2008 19:43:37 +0900

In the function "xfont_open", there's this code (line 611):

          int width = font->space_width, n = pcm != NULL;

          for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++)
            if ((pcm = xfont_get_pcm (xfont, &char2b)) != NULL)
              width += pcm->width, n++;
          font->average_width = width / n;

I'm getting divide-by-zeros during redisplay, because n == 0.

Maybe this represents some degenerate condition (I'm having a hard time
reproducing it currently; I saw it happen while displaying rcirc channel
buffers), but still, it seems the code should avoid dividing by zero in
such a case.



Mayonnaise, n. One of the sauces that serve the French in place of a state

reply via email to

[Prev in Thread] Current Thread [Next in Thread]