Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x68k/dev Fix a kernel panic by printf(1).



details:   https://anonhg.NetBSD.org/src/rev/5d0749653b73
branches:  trunk
changeset: 786443:5d0749653b73
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sun Apr 28 14:44:46 2013 +0000

description:
Fix a kernel panic by printf(1).
The 2nd byte of ISO-2022-JP must be 0x21-0x7e.  Especially,
the character code less than 0x2121 causes SEGV, because a
font address points outside of the CGROM.
Reported by tsutsui@.  Should be pulled up to netbsd-6.

diffstat:

 sys/arch/x68k/dev/ite_tv.c |  36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)

diffs (122 lines):

diff -r c2518b694559 -r 5d0749653b73 sys/arch/x68k/dev/ite_tv.c
--- a/sys/arch/x68k/dev/ite_tv.c        Sun Apr 28 14:32:55 2013 +0000
+++ b/sys/arch/x68k/dev/ite_tv.c        Sun Apr 28 14:44:46 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ite_tv.c,v 1.15 2007/03/11 06:01:05 isaki Exp $        */
+/*     $NetBSD: ite_tv.c,v 1.16 2013/04/28 14:44:46 isaki Exp $        */
 
 /*
  * Copyright (c) 1997 Masaru Oki.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ite_tv.c,v 1.15 2007/03/11 06:01:05 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ite_tv.c,v 1.16 2013/04/28 14:44:46 isaki Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -283,10 +283,10 @@
 
        hi = ip->save_char & 0x7f;
 
-       if (hi >= 0x21 && hi <= 0x7e) {
+       if (hi >= 0x21 && hi <= 0x7e && ch >= 0x21 && ch <= 0x7e) {
                /* multibyte character */
                kf = (volatile short *)tv_kfont[hi];
-               kf += (ch & 0x7f) * FONTHEIGHT;
+               kf += ch * FONTHEIGHT;
                /* draw plane */
                for (fh = 0; fh < FONTHEIGHT; fh++, p += ROWBYTES)
                        *(u_short *)p = *kf++;
@@ -312,10 +312,10 @@
 
        hi = ip->save_char & 0x7f;
 
-       if (hi >= 0x21 && hi <= 0x7e) {
+       if (hi >= 0x21 && hi <= 0x7e && ch >= 0x21 && ch <= 0x7e) {
                /* multibyte character */
                kf = (volatile short *)tv_kfont[hi];
-               kf += (ch & 0x7f) * FONTHEIGHT;
+               kf += ch * FONTHEIGHT;
                /* draw plane */
                for (fh = 0; fh < FONTHEIGHT; fh++, p += ROWBYTES)
                        *(u_short *)p = ~*kf++;
@@ -341,10 +341,10 @@
 
        hi = ip->save_char & 0x7f;
 
-       if (hi >= 0x21 && hi <= 0x7e) {
+       if (hi >= 0x21 && hi <= 0x7e && ch >= 0x21 && ch <= 0x7e) {
                /* multibyte character */
                kf = (volatile short *)tv_kfont[hi];
-               kf += (ch & 0x7f) * FONTHEIGHT;
+               kf += ch * FONTHEIGHT;
                /* draw plane */
                for (fh = 0; fh < FONTHEIGHT; fh++, p += ROWBYTES) {
                        ch = *kf++;
@@ -388,10 +388,10 @@
 
        hi = ip->save_char & 0x7f;
 
-       if (hi >= 0x21 && hi <= 0x7e) {
+       if (hi >= 0x21 && hi <= 0x7e && ch >= 0x21 && ch <= 0x7e) {
                /* multibyte character */
                kf = (volatile short *)tv_kfont[hi];
-               kf += (ch & 0x7f) * FONTHEIGHT;
+               kf += ch * FONTHEIGHT;
                /* draw plane */
                for (fh = 0; fh < UNDERLINE; fh++, p += ROWBYTES)
                        *(u_short *)p = *kf++;
@@ -425,10 +425,10 @@
 
        hi = ip->save_char & 0x7f;
 
-       if (hi >= 0x21 && hi <= 0x7e) {
+       if (hi >= 0x21 && hi <= 0x7e && ch >= 0x21 && ch <= 0x7e) {
                /* multibyte character */
                kf = (volatile short *)tv_kfont[hi];
-               kf += (ch & 0x7f) * FONTHEIGHT;
+               kf += ch * FONTHEIGHT;
                /* draw plane */
                for (fh = 0; fh < FONTHEIGHT; fh++, p += ROWBYTES) {
                        ch = *kf++;
@@ -458,10 +458,10 @@
 
        hi = ip->save_char & 0x7f;
 
-       if (hi >= 0x21 && hi <= 0x7e) {
+       if (hi >= 0x21 && hi <= 0x7e && ch >= 0x21 && ch <= 0x7e) {
                /* multibyte character */
                kf = (volatile short *)tv_kfont[hi];
-               kf += (ch & 0x7f) * FONTHEIGHT;
+               kf += ch * FONTHEIGHT;
                /* draw plane */
                for (fh = 0; fh < UNDERLINE; fh++, p += ROWBYTES)
                        *(u_short *)p = ~*kf++;
@@ -495,10 +495,10 @@
 
        hi = ip->save_char & 0x7f;
 
-       if (hi >= 0x21 && hi <= 0x7e) {
+       if (hi >= 0x21 && hi <= 0x7e && ch >= 0x21 && ch <= 0x7e) {
                /* multibyte character */
                kf = (volatile short *)tv_kfont[hi];
-               kf += (ch & 0x7f) * FONTHEIGHT;
+               kf += ch * FONTHEIGHT;
                /* draw plane */
                for (fh = 0; fh < UNDERLINE; fh++, p += ROWBYTES) {
                        ch = *kf++;
@@ -542,10 +542,10 @@
 
        hi = ip->save_char & 0x7f;
 
-       if (hi >= 0x21 && hi <= 0x7e) {
+       if (hi >= 0x21 && hi <= 0x7e && ch >= 0x21 && ch <= 0x7e) {
                /* multibyte character */
                kf = (volatile short *)tv_kfont[hi];
-               kf += (ch & 0x7f) * FONTHEIGHT;
+               kf += ch * FONTHEIGHT;
                /* draw plane */
                for (fh = 0; fh < UNDERLINE; fh++, p += ROWBYTES) {
                        ch = *kf++;



Home | Main Index | Thread Index | Old Index