From 17aa1a3ff364c3313b72119a71219ed941b71fc1 Mon Sep 17 00:00:00 2001 From: Richard Wilson Date: Sun, 18 Dec 2005 15:53:47 +0000 Subject: [project @ 2005-12-18 15:53:47 by rjw] Ensure bitmap dimensions are as expected before decompression. svn path=/import/netsurf/; revision=1899 --- riscos/bitmap.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'riscos/bitmap.c') diff --git a/riscos/bitmap.c b/riscos/bitmap.c index 65668e563..6e9683e11 100644 --- a/riscos/bitmap.c +++ b/riscos/bitmap.c @@ -557,6 +557,14 @@ void bitmap_decompress(struct bitmap *bitmap) assert(bitmap->compressed); + /* ensure the width/height is correct */ + header = (struct bitmap_compressed_header *)bitmap->compressed; + if ((header->width != bitmap->width) || + (header->height != bitmap->height)) { + LOG(("Warning: Mismatch between bitmap and compressed sizes")); + return; + } + /* create the image memory/header to decompress to */ if (!bitmap_initialise(bitmap, false)) return; @@ -575,7 +583,6 @@ void bitmap_decompress(struct bitmap *bitmap) bitmap->sprite_area = NULL; } else { // LOG(("Decompressed")); - header = (struct bitmap_compressed_header *)bitmap->compressed; area_size = header->input_size + sizeof(struct bitmap_compressed_header); bitmap_compressed_used -= area_size; -- cgit v1.2.3