Skip to content

Commit

Permalink
upx: fix build (#12785)
Browse files Browse the repository at this point in the history
Ref: #12759

Signed-off-by: David Korczynski <[email protected]>
  • Loading branch information
DavidKorczynski authored Nov 27, 2024
1 parent 79faa6d commit 8da89e8
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion projects/upx/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# Temporary fix for clang bug of upx
sed -i 's/ \&\& __clang_major__ < 15//m' /src/upx/src/util/util.cpp
git apply $SRC/upx/fuzzers/build.patch
git apply --ignore-space-change --ignore-whitespace $SRC/upx/fuzzers/build.patch

# build project
# e.g.
Expand Down
19 changes: 8 additions & 11 deletions projects/upx/fuzzers/build.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f278fff..48aad10 100644
index ac15329b..dba7e5f5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -500,6 +500,40 @@ if(Threads_FOUND)
@@ -336,10 +336,87 @@ if(Threads_FOUND)
target_link_libraries(upx Threads::Threads)
endif()

Expand Down Expand Up @@ -43,9 +43,6 @@ index f278fff..48aad10 100644
#***********************************************************************
# target compilation flags
#***********************************************************************
@@ -595,6 +629,49 @@ else()
target_compile_options(${t} PRIVATE ${warn_Wall} ${warn_Werror})
endif()

+foreach(fuzzer ${fuzzers})
+ set(t ${fuzzer})
Expand Down Expand Up @@ -90,22 +87,22 @@ index f278fff..48aad10 100644
+ endif()
+endforeach()
+
#***********************************************************************
# test
# ctest
upx_cmake_include_hook(5_target_compilation_flags)

if(NOT UPX_CONFIG_DISABLE_BZIP2)
diff --git a/src/main.cpp b/src/main.cpp
index f97da20..bcff107 100644
index 2d181687..ccb14660 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1326,6 +1326,7 @@ int upx_main(int argc, char *argv[]) may_throw {
@@ -1341,6 +1341,7 @@ int upx_main(int argc, char *argv[]) may_throw {
// real entry point
**************************************************************************/

+#if !(FUZZING_TESTS)
#if !(WITH_GUI)

#if 1 && (ACC_OS_DOS32) && defined(__DJGPP__)
@@ -1380,5 +1381,6 @@ int __acc_cdecl_main main(int argc, char *argv[]) /*noexcept*/ {
@@ -1394,5 +1395,6 @@ int __acc_cdecl_main main(int argc, char *argv[]) /*noexcept*/ {
}

#endif /* !(WITH_GUI) */
Expand Down
1 change: 0 additions & 1 deletion projects/upx/fuzzers/decompress_packed_file_fuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ limitations under the License.
#include <stdint.h>
#include <stdio.h>

#include "../src/headers.h"
#include "../src/conf.h"
#include "../src/file.h"
#include "../src/packmast.h"
Expand Down
1 change: 0 additions & 1 deletion projects/upx/fuzzers/list_packed_file_fuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ limitations under the License.
#include <stdint.h>
#include <stdio.h>

#include "../src/headers.h"
#include "../src/conf.h"
#include "../src/file.h"
#include "../src/packmast.h"
Expand Down
1 change: 0 additions & 1 deletion projects/upx/fuzzers/test_packed_file_fuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ limitations under the License.
#include <stdint.h>
#include <stdio.h>

#include "../src/headers.h"
#include "../src/conf.h"
#include "../src/file.h"
#include "../src/packmast.h"
Expand Down

0 comments on commit 8da89e8

Please sign in to comment.