From 3123c4298aab5ae2c0d5016d2b92bbb7896b3a29 Mon Sep 17 00:00:00 2001
From: wang_yue111 <648774160@qq.com>
Date: Wed, 3 Mar 2021 10:31:02 +0800
Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/1712

---
 magick/quantum-private.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/magick/quantum-private.h b/magick/quantum-private.h
index 6ce4038..6654c1d 100644
--- a/magick/quantum-private.h
+++ b/magick/quantum-private.h
@@ -324,6 +324,8 @@ static inline Quantum ScaleAnyToQuantum(const QuantumAny quantum,
 static inline QuantumAny ScaleQuantumToAny(const Quantum quantum,
   const QuantumAny range)
 {
+  if (quantum < 0)
+    return((QuantumAny) 0);
   return((QuantumAny) (((MagickRealType) range*quantum)/QuantumRange+0.5));
 }
 
-- 
2.23.0

