update to 111 (#2144160)

backport upstream fixes for OOB reads in string_view
This commit is contained in:
Dominik 'Rathann' Mierzejewski 2022-12-15 12:18:57 +01:00
parent 4a54270af5
commit 3366cda7b1
5 changed files with 4982 additions and 2 deletions

1
.gitignore vendored
View File

@ -11,3 +11,4 @@
/binaryen-version_105.tar.gz
/binaryen-version_109.tar.gz
/binaryen-version_110.tar.gz
/binaryen-version_111.tar.gz

51
5317.patch Normal file
View File

@ -0,0 +1,51 @@
From 3eb0bc0aaf100c5bf1f26aa6fbcd01f4f63b1d15 Mon Sep 17 00:00:00 2001
From: Thomas Lively <tlively@google.com>
Date: Fri, 2 Dec 2022 11:56:46 -0800
Subject: [PATCH] [NFC] Do not read past the end of a string_view
wasm-s-parser.cpp was detecting the end of type strings by looking for null
characters, but those null characters would be past the end of the relevant
string_view. Bring that code in line with similar code by checking the length of
the string_view instead. Fixes an assertion failure in MSVC debug mode.
Fixes #5312.
---
src/wasm/wasm-s-parser.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index ab6230442ac..7bdbc69c675 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -1151,18 +1151,18 @@ Type SExpressionWasmBuilder::stringToType(std::string_view str,
bool prefix) {
if (str.size() >= 3) {
if (str[0] == 'i') {
- if (str[1] == '3' && str[2] == '2' && (prefix || str[3] == 0)) {
+ if (str[1] == '3' && str[2] == '2' && (prefix || str.size() == 3)) {
return Type::i32;
}
- if (str[1] == '6' && str[2] == '4' && (prefix || str[3] == 0)) {
+ if (str[1] == '6' && str[2] == '4' && (prefix || str.size() == 3)) {
return Type::i64;
}
}
if (str[0] == 'f') {
- if (str[1] == '3' && str[2] == '2' && (prefix || str[3] == 0)) {
+ if (str[1] == '3' && str[2] == '2' && (prefix || str.size() == 3)) {
return Type::f32;
}
- if (str[1] == '6' && str[2] == '4' && (prefix || str[3] == 0)) {
+ if (str[1] == '6' && str[2] == '4' && (prefix || str.size() == 3)) {
return Type::f64;
}
}
@@ -1170,7 +1170,7 @@ Type SExpressionWasmBuilder::stringToType(std::string_view str,
if (str.size() >= 4) {
if (str[0] == 'v') {
if (str[1] == '1' && str[2] == '2' && str[3] == '8' &&
- (prefix || str[4] == 0)) {
+ (prefix || str.size() == 4)) {
return Type::v128;
}
}

4919
5349.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,12 +2,15 @@
Summary: Compiler and toolchain infrastructure library for WebAssembly
Name: binaryen
Version: 110
Version: 111
Release: 1%{?dist}
URL: https://github.com/WebAssembly/binaryen
Source0: %{url}/archive/version_%{version}/%{name}-version_%{version}.tar.gz
Patch0: %{name}-use-system-gtest.patch
Patch1: https://github.com/WebAssembly/binaryen/pull/5317.patch
# backported from https://github.com/WebAssembly/binaryen/pull/5349
Patch2: 5349.patch
License: ASL 2.0
# tests fail on big-endian
@ -53,6 +56,8 @@ effective:
%prep
%setup -q -n %{name}-version_%{version}
%patch0 -p1 -b .gtest
%patch1 -p1
%patch2 -p1
%build
%cmake3 \
@ -96,6 +101,10 @@ rm -v %{buildroot}%{_bindir}/binaryen-{lit,unittests}
%{_libdir}/%{name}/libbinaryen.so
%changelog
* Tue Dec 13 2022 Dominik Mierzejewski <dominik@greysector.net> 111-1
- update to 111 (#2144160)
- backport upstream fixes for OOB reads in string_view
* Wed Sep 21 2022 Dominik Mierzejewski <rpm@greysector.net> 110-1
- update to 110 (#2081423)
- fix building with external gtest

View File

@ -1 +1 @@
SHA512 (binaryen-version_110.tar.gz) = bfe5e8c98409a422145aa64c71d3d5b89bba3d965a3981b9db72a3034daee464606dee117eba3fdcb3e9e34d2fdee8f0a30fa48aaff4d5e34723f20cc01f0197
SHA512 (binaryen-version_111.tar.gz) = 249b37a4c6096d7386529166d34753414db80175c403181f8f1d17960681c8abb8710c759ef81826c01575b2696bdd93a769c48ba79ca3acf51e2c91a93c155f