From 20e8da9dfd9bd10a6531369b1f675a2f7de0a2e5 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Mon, 11 Mar 2024 11:36:47 +0100 Subject: Fix: Filechooser preview of XML file shows it as a corrupt image (#926) --- src/fl_images_core.cxx | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/fl_images_core.cxx b/src/fl_images_core.cxx index de34fe3e9..d9f8d41a5 100644 --- a/src/fl_images_core.cxx +++ b/src/fl_images_core.cxx @@ -36,7 +36,6 @@ #include #include #include -#include #include "flstring.h" #if defined(HAVE_LIBZ) #include @@ -126,22 +125,12 @@ fl_check_images(const char *name, // I - Filename // SVG or SVGZ (gzip'ed SVG) #ifdef FLTK_USE_SVG - uchar header2[300]; // buffer for decompression + uchar header2[64]; // buffer for decompression uchar *buf = header; // original header data int count = headerlen; // original header data size // Note: variables 'buf' and 'count' may be overwritten subsequently - // if the image data is xml or gzip'ed *and* we can decompress the data - - if (count >= 5 && memcmp(header, "= 4 && memcmp(buf, "= 5 && memcmp(buf, "= 5 && + (memcmp(buf, "w() && image->h()) + return image; + delete image; } - if (found_svg) return new Fl_SVG_Image(name); #endif // FLTK_USE_SVG // unknown image format -- cgit v1.2.3