]> granicus.if.org Git - imagemagick/commitdiff
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=6801
authorCristy <urban-warrior@imagemagick.org>
Fri, 9 Mar 2018 11:32:24 +0000 (06:32 -0500)
committerCristy <urban-warrior@imagemagick.org>
Fri, 9 Mar 2018 11:32:24 +0000 (06:32 -0500)
MagickCore/quantum-private.h

index 695b8df124b962a1b839fe71f7fa993b472727ab..be8dc6e10c3958c457e5772cb6191c1e9c685ac5 100644 (file)
@@ -21,6 +21,7 @@
 #include "MagickCore/memory_.h"
 #include "MagickCore/cache.h"
 #include "MagickCore/image-private.h"
+#include "MagickCore/pixel-accessor.h"
 
 #if defined(__cplusplus) || defined(c_plusplus)
 extern "C" {
@@ -310,9 +311,11 @@ static inline Quantum ScaleAnyToQuantum(const QuantumAny quantum,
   if (quantum > range)
     return(QuantumRange);
 #if !defined(MAGICKCORE_HDRI_SUPPORT)
-  return((Quantum) (((double) QuantumRange*quantum)/range+0.5));
+  return((Quantum) (((double) QuantumRange*quantum)*
+    PerceptibleReciprocal(range)+0.5));
 #else
-  return((Quantum) (((double) QuantumRange*quantum)/range));
+  return((Quantum) (((double) QuantumRange*quantum)*
+    PerceptibleReciprocal(range)));
 #endif
 }