Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/splash Do not panic if the splash screen is bigger t...



details:   https://anonhg.NetBSD.org/src/rev/150efd7c93c8
branches:  trunk
changeset: 815019:150efd7c93c8
user:      khorben <khorben%NetBSD.org@localhost>
date:      Mon Apr 25 22:26:50 2016 +0000

description:
Do not panic if the splash screen is bigger than the framebuffer

This fixes a kernel crash if the splash screen does not fit inside the
framebuffer. It should probably be truncated (and optionally centered)
instead, but this avoids a panic in the meantime.

Tested on NetBSD/amd64 with a vesa framebuffer.

>From Christian Koch (cfkoch@) of EdgeBSD; thanks!

XXX pull-up(s)

diffstat:

 sys/dev/splash/splash.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (33 lines):

diff -r 2d9391545f8c -r 150efd7c93c8 sys/dev/splash/splash.c
--- a/sys/dev/splash/splash.c   Mon Apr 25 21:21:02 2016 +0000
+++ b/sys/dev/splash/splash.c   Mon Apr 25 22:26:50 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: splash.c,v 1.12 2012/06/02 14:24:00 martin Exp $ */
+/* $NetBSD: splash.c,v 1.13 2016/04/25 22:26:50 khorben Exp $ */
 
 /*-
  * Copyright (c) 2006 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: splash.c,v 1.12 2012/06/02 14:24:00 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: splash.c,v 1.13 2016/04/25 22:26:50 khorben Exp $");
 
 #include "opt_splash.h"
 
@@ -195,6 +195,14 @@
        aprint_debug("%s: splash loaded, width %d height %d comp %d\n",
            __func__, width, height, comp);
 
+       if ((width > si->si_width) || (height > si->si_height)) {
+               aprint_error(
+                       "WARNING: splash size (%dx%d) too big for framebuffer (%dx%d)\n",
+                       width, height, si->si_width, si->si_height);
+               stbi_image_free(data);
+               return EINVAL;
+       }
+
        /* XXX */
        if (flg & SPLASH_F_CENTER) {
                xoff = (si->si_width - width) / 2;



Home | Main Index | Thread Index | Old Index