diff --git a/0001-Backport-Bitcode-Add-some-missing-GetTypeByID-failure-checks.patch b/0001-Backport-Bitcode-Add-some-missing-GetTypeByID-failure-checks.patch new file mode 100644 index 0000000000000000000000000000000000000000..b90af9260bc54126cb396377080962580d321000 --- /dev/null +++ b/0001-Backport-Bitcode-Add-some-missing-GetTypeByID-failure-checks.patch @@ -0,0 +1,37 @@ +From 58f4b115f97435efa1df1baa3247791a13444c00 Mon Sep 17 00:00:00 2001 +From: Nikita Popov +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. +--- + llvm/lib/Bitcode/Reader/MetadataLoader.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp +index 0a9a80688a41..2f024899b451 100644 +--- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp ++++ b/llvm/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 + diff --git a/llvm.spec b/llvm.spec index 458efb52f25e3ce31d25d76e9988ffbcd42414a4..7fcce58b9b119316efe74f795a0d3656ee810156 100644 --- a/llvm.spec +++ b/llvm.spec @@ -1,11 +1,13 @@ Name: llvm Version: 10.0.1 -Release: 3 +Release: 4 Summary: The Low Level Virtual Machine License: NCSA URL: http://llvm.org Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{name}-%{version}.src.tar.xz +Patch1: 0001-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 BuildRequires: python3-recommonmark @@ -53,7 +55,8 @@ Obsoletes: %{name}-doc < %{version}-%{release} The %{name}-help package contains doc files for %{name}. %prep -%autosetup -n %{name}-%{version}.src -p1 +%setup -T -q -b 0 -n %{name}-%{version}.src +%autopatch -p2 pathfix.py -i %{__python3} -pn test/BugPoint/compile-custom.ll.py tools/opt-viewer/*.py %build @@ -196,6 +199,12 @@ fi %{_mandir}/man1/* %changelog +* Tue Apr 09 2024 liyunfei - 10.0.1-4 +- Type: CVE +- ID: NA +- SUG: NA +- Backport patch to fix CVE-2023-46049 + * Fri Nov 24 2023 cf-zhao - 10.0.1-3 - Remove the rpath