Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/rasops Fix catastrophe when ri_emustride != ri_strid...



details:   https://anonhg.NetBSD.org/src/rev/ba98f334d6a0
branches:  trunk
changeset: 452994:ba98f334d6a0
user:      rin <rin%NetBSD.org@localhost>
date:      Tue Jul 30 14:33:04 2019 +0000

description:
Fix catastrophe when ri_emustride != ri_stride in rasops_copyrows().

diffstat:

 sys/dev/rasops/rasops.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (51 lines):

diff -r c553b83b57c5 -r ba98f334d6a0 sys/dev/rasops/rasops.c
--- a/sys/dev/rasops/rasops.c   Tue Jul 30 12:20:24 2019 +0000
+++ b/sys/dev/rasops/rasops.c   Tue Jul 30 14:33:04 2019 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: rasops.c,v 1.98 2019/07/30 12:20:24 rin Exp $ */
+/*      $NetBSD: rasops.c,v 1.99 2019/07/30 14:33:04 rin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.98 2019/07/30 12:20:24 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.99 2019/07/30 14:33:04 rin Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -671,7 +671,7 @@
 {
        struct rasops_info *ri = (struct rasops_info *)cookie;
        uint8_t *sp, *dp, *hp;
-       int n;
+       int n, stride;
 
        hp = NULL;      /* XXX GCC */
 
@@ -701,6 +701,7 @@
 
        num *= ri->ri_font->fontheight;
        n = ri->ri_emustride;
+       stride = ri->ri_stride;
 
        sp = ri->ri_bits + src * ri->ri_yscale;
        dp = ri->ri_bits + dst * ri->ri_yscale;
@@ -709,12 +710,12 @@
 
        while (num--) {
                memmove(dp, sp, n);
-               dp += n;
+               dp += stride;
                if (ri->ri_hwbits) {
                        memcpy(hp, sp, n);
-                       hp += n;
+                       hp += stride;
                }
-               sp += n;
+               sp += stride;
        }
 }
 



Home | Main Index | Thread Index | Old Index