From 4d54d452896fdf9347af68d3854f98f4986eea4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Tschumperl=C3=A9?= <David.Tschumperle@gmail.com>
Date: Sun, 24 Jun 2018 22:08:02 +0200
Subject: [PATCH] .

---
 CImg.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/CImg.h b/CImg.h
index 83db0d9..fbf582a 100644
--- a/CImg.h
+++ b/CImg.h
@@ -49315,6 +49315,12 @@ namespace cimg_library_suffixed {
                               "load_pfm(): WIDTH and HEIGHT fields are undefined in file '%s'.",
                               cimg_instance,
                               filename?filename:"(FILE*)");
+      } else if (W<=0 || H<=0) {
+        if (!file) cimg::fclose(nfile);
+        throw CImgIOException(_cimg_instance
+                              "load_pfm(): WIDTH (%d) and HEIGHT (%d) fields are invalid in file '%s'.",
+                              cimg_instance,W,H,
+                              filename?filename:"(FILE*)");
       }
       if (err==2) {
         while ((err=std::fscanf(nfile," %16383[^\n]",item.data()))!=EOF && (*item=='#' || !err)) std::fgetc(nfile);
-- 
GitLab