!95 Backport patch to fix CVE-2023-46049

From: @liyunfei33 
Reviewed-by: @cf-zhao 
Signed-off-by: @cf-zhao
This commit is contained in:
openeuler-ci-bot 2024-04-12 08:43:33 +00:00 committed by Gitee
commit d7eb2dd607
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From 58f4b115f97435efa1df1baa3247791a13444c00 Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov@redhat.com>
Date: Tue, 26 Sep 2023 16:51:40 +0200
Subject: [PATCH 1/3] [Bitcode] Add some missing GetTypeByID failure checks
Print an error instead of crashing.
Fixes https://github.com/llvm/llvm-project/issues/67388.
---
lib/Bitcode/Reader/MetadataLoader.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
index 0a9a80688a41..2f024899b451 100644
--- a/lib/Bitcode/Reader/MetadataLoader.cpp
+++ b/lib/Bitcode/Reader/MetadataLoader.cpp
@@ -1315,7 +1315,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
}
Type *Ty = getTypeByID(Record[0]);
- if (Ty->isMetadataTy() || Ty->isVoidTy()) {
+ if (!Ty || Ty->isMetadataTy() || Ty->isVoidTy()) {
dropRecord();
break;
}
@@ -1366,7 +1366,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
return error("Invalid record");
Type *Ty = getTypeByID(Record[0]);
- if (Ty->isMetadataTy() || Ty->isVoidTy())
+ if (!Ty || Ty->isMetadataTy() || Ty->isVoidTy())
return error("Invalid record");
MetadataList.assignValue(
--
2.33.0

View File

@ -1,6 +1,6 @@
Name: llvm
Version: 12.0.1
Release: 6
Release: 7
Summary: The Low Level Virtual Machine
License: NCSA
URL: http://llvm.org
@ -8,6 +8,7 @@ Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{versio
Patch1000: 1000-add-loongarch-support-upstream-modified.patch
Patch1001: 1001-add-loongarch-support-upstream-new.patch
Patch1002: 1002-Backport-Bitcode-Add-some-missing-GetTypeByID-failure-checks.patch
BuildRequires: gcc gcc-c++ cmake ninja-build zlib-devel libffi-devel ncurses-devel libstdc++-static
BuildRequires: python3-sphinx binutils-devel valgrind-devel libedit-devel python3-devel
@ -203,6 +204,12 @@ fi
%{_mandir}/man1/*
%changelog
* Tue Apr 09 2024 liyunfei <liyunfei33@huawei.com> - 12.0.1-7
- Type: CVE
- ID: NA
- SUG: NA
- Backport patch to fix CVE-2023-46049
* Sat Mar 09 2024 zhangxianting <zhangxianting@uniontech.com> - 12.0.1-6
- Type: Requires
- ID: NA