diff options
| author | Kazutaka YOKOTA <yokota@FreeBSD.org> | 1999-06-16 14:04:45 +0000 |
|---|---|---|
| committer | Kazutaka YOKOTA <yokota@FreeBSD.org> | 1999-06-16 14:04:45 +0000 |
| commit | 5c539f036dca3fd50bc0a207e629bec18078b1b4 (patch) | |
| tree | ed9a17471d3bd1598be842e83fc2cfa6e07e1c52 /sys/modules/splash | |
| parent | 73568d2bf104227c0726a8a40eae555d9a5a2e7b (diff) | |
Notes
Diffstat (limited to 'sys/modules/splash')
| -rw-r--r-- | sys/modules/splash/bmp/splash_bmp.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/sys/modules/splash/bmp/splash_bmp.c b/sys/modules/splash/bmp/splash_bmp.c index 3b0e500677d5..44ac914fd436 100644 --- a/sys/modules/splash/bmp/splash_bmp.c +++ b/sys/modules/splash/bmp/splash_bmp.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: splash_bmp.c,v 1.6 1999/02/05 11:52:13 yokota Exp $ + * $Id: splash_bmp.c,v 1.7 1999/03/29 15:13:53 yokota Exp $ */ #include <sys/param.h> @@ -73,8 +73,10 @@ bmp_start(video_adapter_t *adp) video_info_t info; int i; - if ((bmp_decoder.data == NULL) || (bmp_decoder.data_size <= 0)) + if ((bmp_decoder.data == NULL) || (bmp_decoder.data_size <= 0)) { + printf("splash_bmp: No bitmap file found\n"); return ENODEV; + } for (i = 0; modes[i] >= 0; ++i) { if (((*vidsw[adp->va_index]->get_info)(adp, modes[i], &info) == 0) && (bmp_Init((u_char *)bmp_decoder.data, @@ -82,6 +84,8 @@ bmp_start(video_adapter_t *adp) break; } splash_mode = modes[i]; + if (splash_mode < 0) + printf("splash_bmp: No appropriate video mode found\n"); if (bootverbose) printf("bmp_start(): splash_mode:%d\n", splash_mode); return ((splash_mode < 0) ? ENODEV : 0); @@ -482,9 +486,17 @@ bmp_Init(const char *data, int swidth, int sheight, int sdepth) /* check file ID */ if (bmf->bmfh.bfType != 0x4d42) { + printf("splash_bmp: not a BMP file\n"); return(1); /* XXX check word ordering for big-endian ports? */ } + /* do we understand this bitmap format? */ + if (bmf->bmfi.bmiHeader.biSize > sizeof(bmf->bmfi.bmiHeader)) { + printf("splash_bmp: unsupported BMP format (size=%d)\n", + bmf->bmfi.bmiHeader.biSize); + return(1); + } + /* save what we know about the screen */ bmp_info.swidth = swidth; bmp_info.sheight = sheight; @@ -504,6 +516,7 @@ bmp_Init(const char *data, int swidth, int sheight, int sdepth) case BI_RLE8: break; default: + printf("splash_bmp: unsupported compression format\n"); return(1); /* unsupported compression format */ } @@ -513,6 +526,12 @@ bmp_Init(const char *data, int swidth, int sheight, int sdepth) if (bmp_info.ncols == 0) { /* uses all of them */ bmp_info.ncols = 1 << bmf->bmfi.bmiHeader.biBitCount; } + if ((bmf->bmfi.bmiHeader.biBitCount != sdepth) + || (bmp_info.ncols > (1 << sdepth))) { + printf("splash_bmp: unsupported color depth (%d bits, %d colors)\n", + bmf->bmfi.bmiHeader.biBitCount, bmp_info.ncols); + return(1); + } if ((bmp_info.height > bmp_info.sheight) || (bmp_info.width > bmp_info.swidth) || (bmp_info.ncols > (1 << sdepth))) { |
