1 Star 0 Fork 42

peijiankang/qt

forked from src-openEuler/qt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CVE-2018-19871.patch 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
syyhao 提交于 2019-12-17 11:10 . init
From 7cfe47a8fe2f987fb2a066a696fb3d9d0afe4d65 Mon Sep 17 00:00:00 2001
From: Eirik Aavitsland <eirik.aavitsland@qt.io>
Date: Fri, 24 Aug 2018 12:03:00 +0200
Subject: [PATCH] TGA handler: check for out of range image size
Make the decoder fail early to avoid spending time and memory on
attempting to decode a corrupt image file.
Change-Id: Iac35e72de743f412a65d11c58fe7faa275dc4e41
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
---
src/plugins/imageformats/tga/qtgafile.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
--- a/src/plugins/imageformats/tga/qtgafile.cpp
+++ b/src/plugins/imageformats/tga/qtgafile.cpp
@@ -165,6 +165,12 @@
if (!validDepth)
{
mErrorMessage = QObject::tr("Image depth not valid");
+ return;
+ }
+ if (quint64(width()) * quint64(height()) > (8192 * 8192))
+ {
+ mErrorMessage = QObject::tr("Image size exceeds limit");
+ return;
}
int fileBytes = mDevice->size();
if (!mDevice->seek(fileBytes - FooterSize))
@@ -237,6 +243,8 @@
unsigned char yCorner = desc & 0x20; // 0 = lower, 1 = upper
QImage im(imageWidth, imageHeight, QImage::Format_ARGB32);
+ if (im.isNull())
+ return QImage();
TgaReader *reader = 0;
if (bitsPerPixel == 16)
reader = new Tga16Reader();
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/peijiankang/qt.git
git@gitee.com:peijiankang/qt.git
peijiankang
qt
qt
master

搜索帮助