[gthumb] Do not process bitmap thumbnails with invalid color settings.
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] Do not process bitmap thumbnails with invalid color settings.
- Date: Tue, 2 May 2017 07:48:12 +0000 (UTC)
commit d9bc1ffa56695a1ffd278bfc7ea063987c844532
Author: Jan de Groot <jgc archlinux org>
Date: Mon Feb 13 13:28:27 2017 +0000
Do not process bitmap thumbnails with invalid color settings.
Libraw sets these to 0 in an excption handler, we should not assert fatal when processing such an image.
[bug #778556]
extensions/raw_files/main.c | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/extensions/raw_files/main.c b/extensions/raw_files/main.c
index 6cf2ff8..9c55e72 100644
--- a/extensions/raw_files/main.c
+++ b/extensions/raw_files/main.c
@@ -267,12 +267,16 @@ _cairo_image_surface_create_from_raw (GInputStream *istream,
error);
break;
case LIBRAW_THUMBNAIL_BITMAP:
- image = _libraw_read_bitmap_data (raw_data->thumbnail.twidth,
- raw_data->thumbnail.theight,
- raw_data->thumbnail.tcolors,
- 8,
- (guchar *) raw_data->thumbnail.thumb,
- raw_data->thumbnail.tlength);
+ if ((raw_data->thumbnail.tcolors > 0) && (raw_data->thumbnail.tcolors <= 4)) {
+ image = _libraw_read_bitmap_data (raw_data->thumbnail.twidth,
+ raw_data->thumbnail.theight,
+ raw_data->thumbnail.tcolors,
+ 8,
+ (guchar *) raw_data->thumbnail.thumb,
+ raw_data->thumbnail.tlength);
+ }
+ else
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA, "Unsupported
data format");
break;
default:
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA, "Unsupported data
format");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]