Module Name:    src
Committed By:   snj
Date:           Sun Aug 28 04:31:19 UTC 2016

Modified Files:
        src/sys/dev/splash [netbsd-7]: splash.c

Log Message:
Pull up following revision(s) (requested by khorben in ticket #1238):
        sys/dev/splash/splash.c: revision 1.13
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)


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.12.14.1 src/sys/dev/splash/splash.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/splash/splash.c
diff -u src/sys/dev/splash/splash.c:1.12 src/sys/dev/splash/splash.c:1.12.14.1
--- src/sys/dev/splash/splash.c:1.12	Sat Jun  2 14:24:00 2012
+++ src/sys/dev/splash/splash.c	Sun Aug 28 04:31:19 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: splash.c,v 1.12 2012/06/02 14:24:00 martin Exp $ */
+/* $NetBSD: splash.c,v 1.12.14.1 2016/08/28 04:31:19 snj Exp $ */
 
 /*-
  * Copyright (c) 2006 Jared D. McNeill <jmcne...@invisible.ca>
@@ -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.12.14.1 2016/08/28 04:31:19 snj Exp $");
 
 #include "opt_splash.h"
 
@@ -195,6 +195,14 @@ splash_render(struct splash_info *si, in
 	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;

Reply via email to