1 Star 0 Fork 20

src-oepkgs-oE-rv/exiv2

forked from src-openEuler/exiv2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Fix-ICC-profile-in-PNG-images.patch 2.02 KB
一键复制 编辑 原始数据 按行查看 历史
wangchen 提交于 2020-04-28 18:01 . fix CVE-2019-13109
From 466acf56a13a1afa88cefbb249b535088d077c20 Mon Sep 17 00:00:00 2001
From: Luis Diaz Mas <piponazo@gmail.com>
Date: Tue, 25 Dec 2018 16:54:26 +0100
Subject: [PATCH] Fix ICC profile in PNG images
(cherry picked from commit 9a38066b8eddf3948696a3362aac29e012ebe690)
---
src/pngimage.cpp | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/pngimage.cpp b/src/pngimage.cpp
index ed7399a..49c8336 100644
--- a/src/pngimage.cpp
+++ b/src/pngimage.cpp
@@ -468,7 +468,20 @@ namespace Exiv2 {
}
else if (!memcmp(cheaderBuf.pData_ + 4, "iCCP", 4))
{
- zlibToDataBuf(cdataBuf.pData_ +12+1,dataOffset-13,iccProfile_); // +1 = 'compressed' flag
+ // The ICC profile name can vary from 1-79 characters.
+ uint32_t iccOffset = 0;
+ while (iccOffset < 80 && iccOffset < dataOffset) {
+
+ const byte* profileName = cdataBuf.pData_ + iccOffset;
+ ++iccOffset;
+
+ if (*profileName == 0x00)
+ break;
+ }
+
+ ++iccOffset; // +1 = 'compressed' flag
+
+ zlibToDataBuf(cdataBuf.pData_ +iccOffset,dataOffset-iccOffset,iccProfile_);
#ifdef DEBUG
std::cout << "Exiv2::PngImage::readMetadata: Found iCCP chunk length: " << dataOffset << std::endl;
std::cout << "Exiv2::PngImage::readMetadata: iccProfile.size_ : " << iccProfile_.size_ << std::endl;
@@ -627,6 +640,7 @@ namespace Exiv2 {
// calculate CRC
uLong tmp = crc32(0L, Z_NULL, 0);
+ tmp = crc32(tmp, (const Bytef*)type ,typeLen);
tmp = crc32(tmp, (const Bytef*)header ,headerLen);
tmp = crc32(tmp, (const Bytef*)compressed.pData_,compressed.size_);
byte crc[4];
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-oepkgs-oe-rv/exiv2.git
git@gitee.com:src-oepkgs-oe-rv/exiv2.git
src-oepkgs-oe-rv
exiv2
exiv2
master

搜索帮助