Skip to content

Commit 0749a46

Browse files
authored
Add ability to process PNG icons for perceptual hash calculation (#1090)
* Add ability to process PNG icons for perceptual hash calculation * Use SCOPE_EXIT for deallocation
1 parent 3435bc8 commit 0749a46

File tree

11 files changed

+8006
-1
lines changed

11 files changed

+8006
-1
lines changed

LICENSE-THIRD-PARTY

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ RetDec uses the following third-party libraries or other resources:
1919
11) Eigen: http://eigen.tuxfamily.org/index.php?title=Main_Page
2020
12) cmake-modules: https://github.com/rpavlik/cmake-modules
2121
13) tlsh: https://github.com/trendmicro/tlsh
22+
13) stb: https://github.com/nothings/stb
2223

2324
These third-party libraries or other resources are licensed under the
2425
following licenses:
@@ -973,3 +974,25 @@ DEALINGS IN THE SOFTWARE.
973974

974975
Jonathan Oliver and Jayson Pryde
975976
http://blog.trendmicro.com/trendlabs-security-intelligence/smart-whitelisting-using-locality-sensitive-hashing/
977+
978+
===============================================================================
979+
12) stb
980+
===============================================================================
981+
982+
MIT License
983+
Copyright (c) 2017 Sean Barrett
984+
Permission is hereby granted, free of charge, to any person obtaining a copy of
985+
this software and associated documentation files (the "Software"), to deal in
986+
the Software without restriction, including without limitation the rights to
987+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
988+
of the Software, and to permit persons to whom the Software is furnished to do
989+
so, subject to the following conditions:
990+
The above copyright notice and this permission notice shall be included in all
991+
copies or substantial portions of the Software.
992+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
993+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
994+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
995+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
996+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
997+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
998+
SOFTWARE.

cmake/options.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,9 @@ set_if_at_least_one_set(RETDEC_ENABLE_YARAMOD
503503
set_if_at_least_one_set(RETDEC_ENABLE_TLSH
504504
RETDEC_ENABLE_FILEFORMAT)
505505

506+
set_if_at_least_one_set(RETDEC_ENABLE_STB
507+
RETDEC_ENABLE_FILEFORMAT)
508+
506509
# Support
507510

508511
set_if_at_least_one_set(RETDEC_ENABLE_SUPPORT_ORDINALS

deps/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ endif()
1414
set(MSVC_GE $<BOOL:${MSVC}>)
1515
set(MSVC_CONFIG $<${MSVC_GE}:$<CONFIG>/>)
1616

17+
cond_add_subdirectory(stb RETDEC_ENABLE_STB)
1718
cond_add_subdirectory(authenticode-parser RETDEC_ENABLE_AUTHENTICODE_PARSER)
1819
cond_add_subdirectory(capstone RETDEC_ENABLE_CAPSTONE)
1920
cond_add_subdirectory(elfio RETDEC_ENABLE_ELFIO)

deps/stb/CMakeLists.txt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
cmake_minimum_required(VERSION 3.13)
2+
3+
project(stb VERSION 1.0.0 LANGUAGES C)
4+
5+
add_library(stb STATIC
6+
stb_image.c
7+
)
8+
9+
add_library(retdec::deps::stb ALIAS stb)
10+
11+
target_include_directories(stb
12+
PUBLIC
13+
$<BUILD_INTERFACE:${RETDEC_DEPS_DIR}/stb/include>
14+
$<INSTALL_INTERFACE:${RETDEC_INSTALL_DEPS_INCLUDE_DIR}>
15+
PRIVATE
16+
${CMAKE_CURRENT_SOURCE_DIR}
17+
)
18+
19+
install(
20+
DIRECTORY ${RETDEC_DEPS_DIR}/stb/include/
21+
DESTINATION ${RETDEC_INSTALL_DEPS_INCLUDE_DIR}
22+
)
23+
24+
install(TARGETS stb
25+
EXPORT stb-targets
26+
ARCHIVE DESTINATION ${RETDEC_INSTALL_LIB_DIR}
27+
LIBRARY DESTINATION ${RETDEC_INSTALL_LIB_DIR}
28+
)
29+
30+
install(EXPORT stb-targets
31+
FILE "retdec-stb-targets.cmake"
32+
NAMESPACE retdec::deps::
33+
DESTINATION ${RETDEC_INSTALL_CMAKE_DIR}
34+
)
35+
36+
configure_file(
37+
"retdec-stb-config.cmake"
38+
"${CMAKE_CURRENT_LIST_DIR}/retdec-stb-config.cmake"
39+
@ONLY
40+
)
41+
install(
42+
FILES "${CMAKE_CURRENT_LIST_DIR}/retdec-stb-config.cmake"
43+
DESTINATION ${RETDEC_INSTALL_CMAKE_DIR}
44+
)

0 commit comments

Comments
 (0)