1 Star 0 Fork 34

zhanghua/ImageMagick

forked from src-openEuler/ImageMagick 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CVE-2020-27760.patch 3.88 KB
一键复制 编辑 原始数据 按行查看 历史
From 83cd04f580ccf4cc194813777c1fcfba78e602aa Mon Sep 17 00:00:00 2001
From: Cristy <urban-warrior@imagemagick.org>
Date: Fri, 4 Oct 2019 18:04:09 -0400
Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/1717
---
magick/enhance.c | 27 ++++++++++++++-------------
1 file changed, 14 insertions(+), 13 deletions(-)
diff --git a/magick/enhance.c b/magick/enhance.c
index a100cf8b7..614269e3a 100644
--- a/magick/enhance.c
+++ b/magick/enhance.c
@@ -2207,7 +2207,8 @@ MagickExport MagickBooleanType GammaImageChannel(Image *image,
if (gamma != 0.0)
for (i=0; i <= (ssize_t) MaxMap; i++)
gamma_map[i]=ClampToQuantum((MagickRealType) ScaleMapToQuantum((
- MagickRealType) (MaxMap*pow((double) i/MaxMap,1.0/gamma))));
+ MagickRealType) (MaxMap*pow((double) i/MaxMap,
+ PerceptibleReciprocal(gamma)))));
if (image->storage_class == PseudoClass)
{
/*
@@ -2238,18 +2239,18 @@ MagickExport MagickBooleanType GammaImageChannel(Image *image,
#else
if ((channel & RedChannel) != 0)
image->colormap[i].red=QuantumRange*gamma_pow(QuantumScale*
- image->colormap[i].red,1.0/gamma);
+ image->colormap[i].red,PerceptibleReciprocal(gamma));
if ((channel & GreenChannel) != 0)
image->colormap[i].green=QuantumRange*gamma_pow(QuantumScale*
- image->colormap[i].green,1.0/gamma);
+ image->colormap[i].green,PerceptibleReciprocal(gamma));
if ((channel & BlueChannel) != 0)
image->colormap[i].blue=QuantumRange*gamma_pow(QuantumScale*
- image->colormap[i].blue,1.0/gamma);
+ image->colormap[i].blue,PerceptibleReciprocal(gamma));
if ((channel & OpacityChannel) != 0)
{
if (image->matte == MagickFalse)
image->colormap[i].opacity=QuantumRange*gamma_pow(QuantumScale*
- image->colormap[i].opacity,1.0/gamma);
+ image->colormap[i].opacity,PerceptibleReciprocal(gamma));
else
image->colormap[i].opacity=QuantumRange-QuantumRange*gamma_pow(
QuantumScale*(QuantumRange-image->colormap[i].opacity),1.0/
@@ -2319,31 +2320,31 @@ MagickExport MagickBooleanType GammaImageChannel(Image *image,
if ((channel & SyncChannels) != 0)
{
SetPixelRed(q,QuantumRange*gamma_pow(QuantumScale*GetPixelRed(q),
- 1.0/gamma));
+ PerceptibleReciprocal(gamma)));
SetPixelGreen(q,QuantumRange*gamma_pow(QuantumScale*GetPixelGreen(q),
- 1.0/gamma));
+ PerceptibleReciprocal(gamma)));
SetPixelBlue(q,QuantumRange*gamma_pow(QuantumScale*GetPixelBlue(q),
- 1.0/gamma));
+ PerceptibleReciprocal(gamma)));
}
else
{
if ((channel & RedChannel) != 0)
SetPixelRed(q,QuantumRange*gamma_pow(QuantumScale*GetPixelRed(q),
- 1.0/gamma));
+ PerceptibleReciprocal(gamma)));
if ((channel & GreenChannel) != 0)
SetPixelGreen(q,QuantumRange*gamma_pow(QuantumScale*
- GetPixelGreen(q),1.0/gamma));
+ GetPixelGreen(q),PerceptibleReciprocal(gamma)));
if ((channel & BlueChannel) != 0)
SetPixelBlue(q,QuantumRange*gamma_pow(QuantumScale*GetPixelBlue(q),
- 1.0/gamma));
+ PerceptibleReciprocal(gamma)));
if ((channel & OpacityChannel) != 0)
{
if (image->matte == MagickFalse)
SetPixelOpacity(q,QuantumRange*gamma_pow(QuantumScale*
- GetPixelOpacity(q),1.0/gamma));
+ GetPixelOpacity(q),PerceptibleReciprocal(gamma)));
else
SetPixelAlpha(q,QuantumRange*gamma_pow(QuantumScale*
- GetPixelAlpha(q),1.0/gamma));
+ GetPixelAlpha(q),PerceptibleReciprocal(gamma)));
}
}
#endif
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhanghua1831/ImageMagick.git
git@gitee.com:zhanghua1831/ImageMagick.git
zhanghua1831
ImageMagick
ImageMagick
master

搜索帮助