diff options
author | KokaKiwi | 2022-08-15 21:38:14 +0200 |
---|---|---|
committer | KokaKiwi | 2022-08-15 21:38:14 +0200 |
commit | a8fcbfa5d083c7e706734c6599395bfecd74088a (patch) | |
tree | febf038b40b74d112cdec18f75fce6c6d242b035 | |
parent | 723f8d9fda5827ab8d51b9871f886276537387af (diff) | |
download | aur-a8fcbfa5d083c7e706734c6599395bfecd74088a.tar.gz |
Add Undefined Behaviour fix patch
-rw-r--r-- | .SRCINFO | 21 | ||||
-rw-r--r-- | 0001-makepkg-Fix-compiler-flags.patch | 2 | ||||
-rw-r--r-- | 0002-makepkg-Fix-compiler-check.patch | 2 | ||||
-rw-r--r-- | 0003-fix-Deduplicate-resources-directories.patch | 2 | ||||
-rw-r--r-- | 0004-makepkg-Fix-build-with-clang.patch | 2 | ||||
-rw-r--r-- | 0005-fix-Some-occurrences-of-undefined-behaviour.patch | 48 | ||||
-rw-r--r-- | PKGBUILD | 26 |
7 files changed, 79 insertions, 24 deletions
@@ -1,7 +1,7 @@ pkgbase = imhex pkgdesc = A Hex Editor for Reverse Engineers, Programmers and people that value their eye sight when working at 3 AM pkgver = 1.21.1 - pkgrel = 1 + pkgrel = 2 url = https://imhex.werwolv.net arch = x86_64 license = GPL2 @@ -35,25 +35,28 @@ pkgbase = imhex source = 0002-makepkg-Fix-compiler-check.patch source = 0003-fix-Deduplicate-resources-directories.patch source = 0004-makepkg-Fix-build-with-clang.patch + source = 0005-fix-Some-occurrences-of-undefined-behaviour.patch sha256sums = SKIP sha256sums = SKIP sha256sums = SKIP sha256sums = SKIP sha256sums = SKIP sha256sums = SKIP - sha256sums = a75f6b2c5193c937aa692d4c787fe9438b7ff2258eb185d40f6a273fd4b27103 - sha256sums = a8e03e3528cbc81d725ff26eb4e41a6db38178f4db1700c8c6e9063076d3256f - sha256sums = 9df4ae1d85df0d9612d7cc0f029ca27da19fe9c43ad2609f84c39f2f2ad27cf2 - sha256sums = fb15c08769ae5c8f31a113204fd0cb8b0e5ee8defc3c8f773e2a1a2e06c1abd4 + sha256sums = 7cfdbcb6352991fb6291e05b9962121fc7bce4462dfc09353830fa826f8d5383 + sha256sums = 8cd77697c42945f207092175728468613992ca33d47974132cc39c378ea16e00 + sha256sums = 0be236fcd1a1d67eed8bfcb3950c04e1040e783acd60893e72756f8e19b7fc40 + sha256sums = 64d198eff9b9d7129bcbde1c0035d6d45d97454ccf2102190c163846622c5bb5 + sha256sums = cf4162fc661eb3684e060126d02b9ca68f40ed67cfff3fee2e7e01a900c525da b2sums = SKIP b2sums = SKIP b2sums = SKIP b2sums = SKIP b2sums = SKIP b2sums = SKIP - b2sums = 44609518926b99d480373fff1164804329979eed5c3cf9cf0645896c774c4bd382a73d04dfb7a86ff33a30a816c22f8b7f9f5adf3bad11403b8484638cfdf9e0 - b2sums = 4474e4566253b32b22270b0ef32353b536bc8f7a08b2405e32a6ed270a6283b168978c500bf0921ded1e1884adf87bc01d1c98b3b58c893549aea4108d4a50bd - b2sums = 1792a1bcb469c821c0ee8f82bbd6515e9d7d3a925967573a858364b7eabc4411e596670639fb1be915ca804827e3b14dd1703d2868571b604e022989c694bd23 - b2sums = 9d30839adf346de25a8ef49837b0c78e8bc2d07737216759889b5f7df7ac1e66f1acb33bc207d4d81ee2db4033a4feabbb67aafa8188b8b273ece93f0f499601 + b2sums = 13b7ec6ecb7043f672b1ddf6ead34d2f523ffa1509916c496105c3a0a675783ca10d90f5c0c8662da750a769fb3f1b76914918b60317c90bacf21c207f04b100 + b2sums = 624197c84cd3f812453b471632d24c7cf446da8be31b8997892bb96148dfba480fbf748c05629886a3de846ace9725331e192fdf0d43e72d4850606b40da8401 + b2sums = ab99e00d4db4c65eda48be90f0eb7c42e2032b593ab0d4219980210c8d1aa6d8f61efef867b9d87def427ab0e3404d4aa358f7870c581ebdc48c06e25e6524d4 + b2sums = 56775e9156b9a029b40268ddacc41d6a184d4d42bd000a464a8f6de7429ef07b83cf87e48b45ec78394a602a5228769a6535caa321589de3cab88caf8ae436a9 + b2sums = be5b9f3299337139a00819bdc87ec321a1ea961f2eea54877e9f9bfaea7b365dd772d5b85d44357c6054b57df0a2232f53e535d9b5ead9b1c2e7a0eb9a138c08 pkgname = imhex diff --git a/0001-makepkg-Fix-compiler-flags.patch b/0001-makepkg-Fix-compiler-flags.patch index b9900f6a4f78..950b2481da31 100644 --- a/0001-makepkg-Fix-compiler-flags.patch +++ b/0001-makepkg-Fix-compiler-flags.patch @@ -1,7 +1,7 @@ From d8ad620ca5fa63bb5a01c9c8f6bc8c1e586890f5 Mon Sep 17 00:00:00 2001 From: KokaKiwi <kokakiwi+git@kokakiwi.net> Date: Mon, 8 Aug 2022 00:34:05 +0200 -Subject: [PATCH 1/4] makepkg: Fix compiler flags +Subject: [PATCH 1/5] makepkg: Fix compiler flags --- cmake/build_helpers.cmake | 10 +++++++--- diff --git a/0002-makepkg-Fix-compiler-check.patch b/0002-makepkg-Fix-compiler-check.patch index 3d2aee942ea1..79edbf5fb920 100644 --- a/0002-makepkg-Fix-compiler-check.patch +++ b/0002-makepkg-Fix-compiler-check.patch @@ -1,7 +1,7 @@ From 451ed119bd4ab284bdf8e85f6fafb04d67516dd8 Mon Sep 17 00:00:00 2001 From: KokaKiwi <kokakiwi+git@kokakiwi.net> Date: Sun, 14 Aug 2022 23:01:45 +0200 -Subject: [PATCH 2/4] makepkg: Fix compiler check +Subject: [PATCH 2/5] makepkg: Fix compiler check --- cmake/build_helpers.cmake | 2 +- diff --git a/0003-fix-Deduplicate-resources-directories.patch b/0003-fix-Deduplicate-resources-directories.patch index 0dc61b8dd68d..54f61a7fae9b 100644 --- a/0003-fix-Deduplicate-resources-directories.patch +++ b/0003-fix-Deduplicate-resources-directories.patch @@ -1,7 +1,7 @@ From 4ea41868c53f4421d7a658f191d11a6fdcabb926 Mon Sep 17 00:00:00 2001 From: KokaKiwi <kokakiwi+git@kokakiwi.net> Date: Sat, 11 Jun 2022 23:08:31 +0200 -Subject: [PATCH 3/4] fix: Deduplicate resources directories +Subject: [PATCH 3/5] fix: Deduplicate resources directories It seems to actually happens despite xdgpp already doing that... --- diff --git a/0004-makepkg-Fix-build-with-clang.patch b/0004-makepkg-Fix-build-with-clang.patch index d9c228688955..b99679b58e52 100644 --- a/0004-makepkg-Fix-build-with-clang.patch +++ b/0004-makepkg-Fix-build-with-clang.patch @@ -1,7 +1,7 @@ From 795d0c33f56bd22a5676d44c2b814830575797c5 Mon Sep 17 00:00:00 2001 From: KokaKiwi <kokakiwi+git@kokakiwi.net> Date: Sun, 14 Aug 2022 23:59:30 +0200 -Subject: [PATCH 4/4] makepkg: Fix build with clang +Subject: [PATCH 4/5] makepkg: Fix build with clang clang does not support some C++20 features --- diff --git a/0005-fix-Some-occurrences-of-undefined-behaviour.patch b/0005-fix-Some-occurrences-of-undefined-behaviour.patch new file mode 100644 index 000000000000..cb7e43db353f --- /dev/null +++ b/0005-fix-Some-occurrences-of-undefined-behaviour.patch @@ -0,0 +1,48 @@ +From 2deca6840be6014e256d0f83a905082d1b0ba69f Mon Sep 17 00:00:00 2001 +From: WerWolv <werwolv98@gmail.com> +Date: Mon, 15 Aug 2022 21:08:09 +0200 +Subject: [PATCH 5/5] fix: Some occurrences of undefined behaviour + +--- + lib/libimhex/include/hex/helpers/utils.hpp | 2 +- + plugins/builtin/source/content/data_inspector.cpp | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/lib/libimhex/include/hex/helpers/utils.hpp b/lib/libimhex/include/hex/helpers/utils.hpp +index f6baaaa6..f414f4e7 100644 +--- a/lib/libimhex/include/hex/helpers/utils.hpp ++++ b/lib/libimhex/include/hex/helpers/utils.hpp +@@ -68,7 +68,7 @@ namespace hex { + } + + constexpr inline i128 signExtend(size_t numBits, i128 value) { +- i128 mask = 1U << (numBits - 1); ++ i128 mask = 1ULL << (numBits - 1); + return (value ^ mask) - mask; + } + +diff --git a/plugins/builtin/source/content/data_inspector.cpp b/plugins/builtin/source/content/data_inspector.cpp +index 6642e939..e4419c1f 100644 +--- a/plugins/builtin/source/content/data_inspector.cpp ++++ b/plugins/builtin/source/content/data_inspector.cpp +@@ -86,7 +86,7 @@ namespace hex::plugin::builtin { + auto format = (style == Style::Decimal) ? "{0:d}" : ((style == Style::Hexadecimal) ? hex::format("0x{{0:0{}X}}", Size * 2) : hex::format("0o{{0:0{}o}}", Size * 3)); + + T value = 0x00; +- std::memcpy(&value, buffer.data(), Size); ++ std::memcpy(&value, buffer.data(), std::min(sizeof(T), Size)); + return hex::format(format, hex::changeEndianess(value, Size, endian)); + } + +@@ -98,7 +98,7 @@ namespace hex::plugin::builtin { + auto format = (style == Style::Decimal) ? "{0}{1:d}" : ((style == Style::Hexadecimal) ? hex::format("{{0}}0x{{1:0{}X}}", Size * 2) : hex::format("{{0}}0o{{1:0{}o}}", Size * 3)); + + T value = 0x00; +- std::memcpy(&value, buffer.data(), Size); ++ std::memcpy(&value, buffer.data(), std::min(sizeof(T), Size)); + auto number = hex::signExtend(Size * 8, hex::changeEndianess(value, Size, endian)); + bool negative = number < 0; + +-- +2.37.2 + @@ -4,7 +4,7 @@ _pkgname=ImHex pkgname=${_pkgname,,} pkgver=1.21.1 -pkgrel=1 +pkgrel=2 pkgdesc='A Hex Editor for Reverse Engineers, Programmers and people that value their eye sight when working at 3 AM' url='https://imhex.werwolv.net' license=('GPL2') @@ -25,27 +25,30 @@ source=("$pkgname::git+https://github.com/WerWolv/ImHex.git#tag=v$pkgver" 0001-makepkg-Fix-compiler-flags.patch 0002-makepkg-Fix-compiler-check.patch 0003-fix-Deduplicate-resources-directories.patch - 0004-makepkg-Fix-build-with-clang.patch) + 0004-makepkg-Fix-build-with-clang.patch + 0005-fix-Some-occurrences-of-undefined-behaviour.patch) sha256sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' - 'a75f6b2c5193c937aa692d4c787fe9438b7ff2258eb185d40f6a273fd4b27103' - 'a8e03e3528cbc81d725ff26eb4e41a6db38178f4db1700c8c6e9063076d3256f' - '9df4ae1d85df0d9612d7cc0f029ca27da19fe9c43ad2609f84c39f2f2ad27cf2' - 'fb15c08769ae5c8f31a113204fd0cb8b0e5ee8defc3c8f773e2a1a2e06c1abd4') + '7cfdbcb6352991fb6291e05b9962121fc7bce4462dfc09353830fa826f8d5383' + '8cd77697c42945f207092175728468613992ca33d47974132cc39c378ea16e00' + '0be236fcd1a1d67eed8bfcb3950c04e1040e783acd60893e72756f8e19b7fc40' + '64d198eff9b9d7129bcbde1c0035d6d45d97454ccf2102190c163846622c5bb5' + 'cf4162fc661eb3684e060126d02b9ca68f40ed67cfff3fee2e7e01a900c525da') b2sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' - '44609518926b99d480373fff1164804329979eed5c3cf9cf0645896c774c4bd382a73d04dfb7a86ff33a30a816c22f8b7f9f5adf3bad11403b8484638cfdf9e0' - '4474e4566253b32b22270b0ef32353b536bc8f7a08b2405e32a6ed270a6283b168978c500bf0921ded1e1884adf87bc01d1c98b3b58c893549aea4108d4a50bd' - '1792a1bcb469c821c0ee8f82bbd6515e9d7d3a925967573a858364b7eabc4411e596670639fb1be915ca804827e3b14dd1703d2868571b604e022989c694bd23' - '9d30839adf346de25a8ef49837b0c78e8bc2d07737216759889b5f7df7ac1e66f1acb33bc207d4d81ee2db4033a4feabbb67aafa8188b8b273ece93f0f499601') + '13b7ec6ecb7043f672b1ddf6ead34d2f523ffa1509916c496105c3a0a675783ca10d90f5c0c8662da750a769fb3f1b76914918b60317c90bacf21c207f04b100' + '624197c84cd3f812453b471632d24c7cf446da8be31b8997892bb96148dfba480fbf748c05629886a3de846ace9725331e192fdf0d43e72d4850606b40da8401' + 'ab99e00d4db4c65eda48be90f0eb7c42e2032b593ab0d4219980210c8d1aa6d8f61efef867b9d87def427ab0e3404d4aa358f7870c581ebdc48c06e25e6524d4' + '56775e9156b9a029b40268ddacc41d6a184d4d42bd000a464a8f6de7429ef07b83cf87e48b45ec78394a602a5228769a6535caa321589de3cab88caf8ae436a9' + 'be5b9f3299337139a00819bdc87ec321a1ea961f2eea54877e9f9bfaea7b365dd772d5b85d44357c6054b57df0a2232f53e535d9b5ead9b1c2e7a0eb9a138c08') options=(!lto !strip) prepare() { @@ -64,7 +67,8 @@ prepare() { "$srcdir/0001-makepkg-Fix-compiler-flags.patch" \ "$srcdir/0002-makepkg-Fix-compiler-check.patch" \ "$srcdir/0003-fix-Deduplicate-resources-directories.patch" \ - "$srcdir/0004-makepkg-Fix-build-with-clang.patch" + "$srcdir/0004-makepkg-Fix-build-with-clang.patch" \ + "$srcdir/0005-fix-Some-occurrences-of-undefined-behaviour.patch" } build() { |