[PATCH] fb: reorder Bresenham error correction to avoid overshoot. #24274

Simon Schubert 2 at 0x2c.org
Mon Jan 30 10:44:30 PST 2012


When fbBresSolid draws a line, it can happen that after the last
pixel, the Bresenham error term overflows, and fbBresSolid paints
another pixel before adjusting the error term.

However, if this happens on the last pixel (len=0), this extra pixel
might overshoot the boundary, and, in rare cases, lead to a segfault.

Fix this issue by adjusting for the Bresenham error term before
drawing the main pixel, not after.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=24274

Signed-off-by: Simon Schubert <2 at 0x2c.org>
---
 fb/fbseg.c |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: &quot
Type: text/x-patch
Size: 1443 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20120130/f468e7c4/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 900 bytes
Desc: OpenPGP digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20120130/f468e7c4/attachment.pgp>


More information about the xorg-devel mailing list