commit 27d08989a5a567155d506ac870ae7d8cc88fa58b
Author: Michael R Sweet <msweet@msweet.org>
Date:   Fri Nov 5 09:35:10 2021 -0400

    Fix potential BMP stack overflow (Issue #453)

Index: htmldoc-1.9.3/htmldoc/image.cxx
===================================================================
--- htmldoc-1.9.3.orig/htmldoc/image.cxx	2022-02-26 01:02:38.045520508 +0100
+++ htmldoc-1.9.3/htmldoc/image.cxx	2022-02-26 01:02:38.045520508 +0100
@@ -904,12 +904,16 @@
     return (-1);
 
   if (info_size > 40)
+  {
     for (info_size -= 40; info_size > 0; info_size --)
       getc(fp);
+  }
 
   // Get colormap...
   if (colors_used == 0 && depth <= 8)
     colors_used = 1 << depth;
+  else if (colors_used > 256)
+    return (-1);
 
   fread(colormap, (size_t)colors_used, 4, fp);
 
