Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ baseline_filtered.info: baseline.info
$(LCOV) -a $@ $(LCOV_OPTS) -o $@

fuzz.info: baseline_filtered.info
@TIMEOUT=15 test/fuzz/test_runner.py $(DIR_FUZZ_SEED_CORPUS) -l DEBUG
@test/fuzz/test_runner.py $(DIR_FUZZ_SEED_CORPUS) -l DEBUG
$(LCOV) -c $(LCOV_OPTS) -d $(abs_builddir)/src --t fuzz-tests -o $@
$(LCOV) -z $(LCOV_OPTS) -d $(abs_builddir)/src

Expand All @@ -212,7 +212,7 @@ test_dash_filtered.info: test_dash.info
$(LCOV) -a $@ $(LCOV_OPTS) -o $@

functional_test.info: test_dash_filtered.info
@TIMEOUT=15 test/functional/test_runner.py $(EXTENDED_FUNCTIONAL_TESTS)
@test/functional/test_runner.py $(EXTENDED_FUNCTIONAL_TESTS)
$(LCOV) -c $(LCOV_OPTS) -d $(abs_builddir)/src --t functional-tests -o $@
$(LCOV) -z $(LCOV_OPTS) -d $(abs_builddir)/src

Expand Down
29 changes: 15 additions & 14 deletions depends/packages/miniupnpc.mk
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
package=miniupnpc
$(package)_version=2.2.2
$(package)_version=2.2.7
$(package)_download_path=https://miniupnp.tuxfamily.org/files/
$(package)_file_name=$(package)-$($(package)_version).tar.gz
$(package)_sha256_hash=888fb0976ba61518276fe1eda988589c700a3f2a69d71089260d75562afd3687
$(package)_patches=dont_leak_info.patch respect_mingw_cflags.patch no_libtool.patch
$(package)_sha256_hash=b0c3a27056840fd0ec9328a5a9bac3dc5e0ec6d2e8733349cf577b0aa1e70ac1
$(package)_patches=dont_leak_info.patch cmake_get_src_addr.patch fix_windows_snprintf.patch
$(package)_build_subdir=build

# Next time this package is updated, ensure that _WIN32_WINNT is still properly set.
# See discussion in https://github.com/bitcoin/bitcoin/pull/25964.
define $(package)_set_vars
$(package)_build_opts=CC="$($(package)_cc)"
$(package)_build_opts_mingw32=-f Makefile.mingw CFLAGS="$($(package)_cflags) -D_WIN32_WINNT=0x0A00"
$(package)_build_env+=CFLAGS="$($(package)_cflags) $($(package)_cppflags)" AR="$($(package)_ar)"
$(package)_config_opts = -DUPNPC_BUILD_SAMPLE=OFF -DUPNPC_BUILD_SHARED=OFF
$(package)_config_opts += -DUPNPC_BUILD_STATIC=ON -DUPNPC_BUILD_TESTS=OFF
$(package)_config_opts_mingw32 += -DMINIUPNPC_TARGET_WINDOWS_VERSION=0x0A00
endef

define $(package)_preprocess_cmds
patch -p1 < $($(package)_patch_dir)/dont_leak_info.patch && \
patch -p1 < $($(package)_patch_dir)/respect_mingw_cflags.patch && \
patch -p1 < $($(package)_patch_dir)/no_libtool.patch
patch -p1 < $($(package)_patch_dir)/cmake_get_src_addr.patch && \
patch -p1 < $($(package)_patch_dir)/fix_windows_snprintf.patch
endef

define $(package)_config_cmds
$($(package)_cmake) -S .. -B .
endef

define $(package)_build_cmds
$(MAKE) libminiupnpc.a $($(package)_build_opts)
$(MAKE)
endef

define $(package)_stage_cmds
mkdir -p $($(package)_staging_prefix_dir)/include/miniupnpc $($(package)_staging_prefix_dir)/lib &&\
install *.h $($(package)_staging_prefix_dir)/include/miniupnpc &&\
install libminiupnpc.a $($(package)_staging_prefix_dir)/lib
cmake --install . --prefix $($(package)_staging_prefix_dir)
endef

define $(package)_postprocess_cmds
Expand Down
22 changes: 22 additions & 0 deletions depends/patches/miniupnpc/cmake_get_src_addr.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
commit cb2026239c2a3aff393952ccb0ee1c448189402d
Author: fanquake <fanquake@gmail.com>
Date: Fri Mar 22 14:03:54 2024 +0000

build: add MINIUPNPC_GET_SRC_ADDR to CMake build

This mirrors the autotools build.

See https://github.com/miniupnp/miniupnp/pull/721.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1aa95a8..0cacf3e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,6 +31,7 @@ endif ()
if (NOT WIN32)
target_compile_definitions(miniupnpc-private INTERFACE
MINIUPNPC_SET_SOCKET_TIMEOUT
+ MINIUPNPC_GET_SRC_ADDR
_BSD_SOURCE _DEFAULT_SOURCE)
if (NOT APPLE AND NOT CMAKE_SYSTEM_NAME MATCHES ".*BSD" AND NOT CMAKE_SYSTEM_NAME STREQUAL "SunOS")
# add_definitions (-D_POSIX_C_SOURCE=200112L)
26 changes: 13 additions & 13 deletions depends/patches/miniupnpc/dont_leak_info.patch
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
commit 8815452257437ba36607d0e2381c01142d1c7bb0
commit 51f6dd991c29af66fb4f64c6feb2787cce23a1a7
Author: fanquake <fanquake@gmail.com>
Date: Thu Nov 19 10:51:19 2020 +0800
Date: Mon Jan 8 11:21:40 2024 +0000

Don't leak OS and miniupnpc version info in User-Agent

diff --git a//minisoap.c b/minisoap.c
index 7860667..775580b 100644
--- a/minisoap.c
+++ b/minisoap.c
diff --git a/src/minisoap.c b/src/minisoap.c
index 903ac5f..046e0ea 100644
--- a/src/minisoap.c
+++ b/src/minisoap.c
@@ -90,7 +90,7 @@ int soapPostSubmit(SOCKET fd,
headerssize = snprintf(headerbuf, sizeof(headerbuf),
"POST %s HTTP/%s\r\n"
"Host: %s%s\r\n"
- "User-Agent: " OS_STRING ", " UPNP_VERSION_STRING ", MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n"
- "User-Agent: " OS_STRING " " UPNP_VERSION_STRING " MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n"
+ "User-Agent: " UPNP_VERSION_STRING "\r\n"
"Content-Length: %d\r\n"
#if (UPNP_VERSION_MAJOR == 1) && (UPNP_VERSION_MINOR == 0)
"Content-Type: text/xml\r\n"
"SOAPAction: \"%s\"\r\n"
diff --git a/miniwget.c b/miniwget.c
index d5b7970..05aeb9c 100644
--- a/miniwget.c
+++ b/miniwget.c
diff --git a/src/miniwget.c b/src/miniwget.c
index e76a5e5..0cc36fe 100644
--- a/src/miniwget.c
+++ b/src/miniwget.c
@@ -444,7 +444,7 @@ miniwget3(const char * host,
"GET %s HTTP/%s\r\n"
"Host: %s:%d\r\n"
"Connection: Close\r\n"
- "User-Agent: " OS_STRING ", " UPNP_VERSION_STRING ", MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n"
- "User-Agent: " OS_STRING " " UPNP_VERSION_STRING " MiniUPnPc/" MINIUPNPC_VERSION_STRING "\r\n"
+ "User-Agent: " UPNP_VERSION_STRING "\r\n"

"\r\n",
Expand Down
25 changes: 25 additions & 0 deletions depends/patches/miniupnpc/fix_windows_snprintf.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
commit a1e9de80ab99b4c956a6a4e21d3e0de6f7a1014d
Author: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
Date: Sat Apr 20 15:14:47 2024 +0100

Fix macro expression that guards `snprintf` for Windows

Otherwise, the `snprintf` is still wrongly emulated for the following
cases:
- mingw-w64 6.0.0 or new with ucrt
- mingw-w64 8.0.0 or new with iso c ext

--- a/src/win32_snprintf.h
+++ b/src/win32_snprintf.h
@@ -23,9 +23,9 @@
(defined(_MSC_VER) && _MSC_VER < 1900) /* Visual Studio older than 2015 */ || \
(defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) && defined(__NO_ISOCEXT)) /* mingw32 without iso c ext */ || \
(defined(__MINGW64_VERSION_MAJOR) && /* mingw-w64 not ... */ !( \
- (defined (__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO != 0)) /* ... with ansi stdio */ || \
+ (defined (__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO != 0) /* ... with ansi stdio */ || \
(__MINGW64_VERSION_MAJOR >= 6 && defined(_UCRT)) /* ... at least 6.0.0 with ucrt */ || \
- (__MINGW64_VERSION_MAJOR >= 8 && !defined(__NO_ISOCEXT)) /* ... at least 8.0.0 with iso c ext */ || \
+ (__MINGW64_VERSION_MAJOR >= 8 && !defined(__NO_ISOCEXT))) /* ... at least 8.0.0 with iso c ext */ || \
0) || \
0)

15 changes: 0 additions & 15 deletions depends/patches/miniupnpc/no_libtool.patch

This file was deleted.

23 changes: 0 additions & 23 deletions depends/patches/miniupnpc/respect_mingw_cflags.patch

This file was deleted.

2 changes: 1 addition & 1 deletion doc/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ You can find installation instructions in the `build-*.md` file for your platfor
| Dependency | Releases | Version used | Minimum required | Runtime |
| --- | --- | --- | --- | --- |
| [libnatpmp](../depends/packages/libnatpmp.mk) | [link](https://github.com/miniupnp/libnatpmp/) | commit [07004b9...](https://github.com/miniupnp/libnatpmp/tree/07004b97cf691774efebe70404cf22201e4d330d) | | No |
| [MiniUPnPc](../depends/packages/miniupnpc.mk) | [link](https://miniupnp.tuxfamily.org/) | [2.2.2](https://github.com/bitcoin/bitcoin/pull/20421) | 2.1 | No |
| [MiniUPnPc](../depends/packages/miniupnpc.mk) | [link](https://miniupnp.tuxfamily.org/) | [2.2.7](https://github.com/bitcoin/bitcoin/pull/29707) | 2.1 | No |

### Notifications
| Dependency | Releases | Version used | Minimum required | Runtime |
Expand Down
2 changes: 2 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ BITCOIN_CORE_H = \
undo.h \
unordered_lru_cache.h \
util/bip32.h \
util/bitset.h \
util/bytevectorhash.h \
util/check.h \
util/edge.h \
Expand Down Expand Up @@ -436,6 +437,7 @@ BITCOIN_CORE_H = \
util/translation.h \
util/types.h \
util/ui_change_type.h \
util/vecdeque.h \
util/vector.h \
util/wpipe.h \
validation.h \
Expand Down
2 changes: 2 additions & 0 deletions src/Makefile.test.include
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ test_fuzz_fuzz_SOURCES = \
test/fuzz/base_encode_decode.cpp \
test/fuzz/bech32.cpp \
test/fuzz/bip324.cpp \
test/fuzz/bitset.cpp \
test/fuzz/block.cpp \
test/fuzz/block_header.cpp \
test/fuzz/blockfilter.cpp \
Expand Down Expand Up @@ -379,6 +380,7 @@ test_fuzz_fuzz_SOURCES = \
test/fuzz/utxo_snapshot.cpp \
test/fuzz/utxo_total_supply.cpp \
test/fuzz/validation_load_mempool.cpp \
test/fuzz/vecdeque.cpp \
test/fuzz/versionbits.cpp
endif # ENABLE_FUZZ_BINARY

Expand Down
2 changes: 1 addition & 1 deletion src/net_processing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5305,7 +5305,7 @@ void PeerManagerImpl::ProcessMessage(
std::vector<unsigned char> vData;
vRecv >> vData;

// Nodes must NEVER send a data item > 520 bytes (the max size for a script data object,
// Nodes must NEVER send a data item > MAX_SCRIPT_ELEMENT_SIZE bytes (the max size for a script data object,
// and thus, the maximum size any matched object can have) in a filteradd message
bool bad = false;
if (vData.size() > MAX_SCRIPT_ELEMENT_SIZE) {
Expand Down
2 changes: 1 addition & 1 deletion src/outputtype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ CTxDestination AddAndGetDestinationForScript(FillableSigningProvider& keystore,
// Add script to keystore
keystore.AddCScript(script);
ScriptHash sh(script);
// Note that scripts over 520 bytes are not yet supported.
// Note that scripts over MAX_SCRIPT_ELEMENT_SIZE bytes are not yet supported.
switch (type) {
case OutputType::LEGACY:
keystore.AddCScript(GetScriptForDestination(sh));
Expand Down
2 changes: 1 addition & 1 deletion src/policy/policy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ bool IsStandardTx(const CTransaction& tx, bool permit_bare_multisig, const CFeeR
for (const CTxIn& txin : tx.vin)
{
// Biggest 'standard' txin involving only keys is a 15-of-15 P2SH
// multisig with compressed keys (remember the 520 byte limit on
// multisig with compressed keys (remember the MAX_SCRIPT_ELEMENT_SIZE byte limit on
// redeemScript size). That works out to a (15*(33+1))+3=513 byte
// redeemScript, 513+1+15*(73+1)+3=1627 bytes of scriptSig, which
// we round off to 1650(MAX_STANDARD_SCRIPTSIG_SIZE) bytes for
Expand Down
6 changes: 1 addition & 5 deletions src/rpc/output_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,7 @@ static RPCHelpMan createmultisig()
const UniValue& keys = request.params[1].get_array();
std::vector<CPubKey> pubkeys;
for (unsigned int i = 0; i < keys.size(); ++i) {
if (IsHex(keys[i].get_str()) && (keys[i].get_str().length() == 66 || keys[i].get_str().length() == 130)) {
pubkeys.push_back(HexToPubKey(keys[i].get_str()));
} else {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, strprintf("Invalid public key: %s\n.", keys[i].get_str()));
}
pubkeys.push_back(HexToPubKey(keys[i].get_str()));
}

// Construct using pay-to-script-hash:
Expand Down
7 changes: 5 additions & 2 deletions src/rpc/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,14 @@ std::string HelpExampleRpcNamed(const std::string& methodname, const RPCArgList&
CPubKey HexToPubKey(const std::string& hex_in)
{
if (!IsHex(hex_in)) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid public key: " + hex_in);
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pubkey \"" + hex_in + "\" must be a hex string");
}
if (hex_in.length() != 66 && hex_in.length() != 130) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pubkey \"" + hex_in + "\" must have a length of either 33 or 65 bytes");
}
CPubKey vchPubKey(ParseHex(hex_in));
if (!vchPubKey.IsFullyValid()) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid public key: " + hex_in);
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Pubkey \"" + hex_in + "\" must be cryptographically valid.");
}
return vchPubKey;
}
Expand Down
Loading
Loading