From 7259f07a200fd583deb0dca1372bbe5fd760b440 Mon Sep 17 00:00:00 2001 From: Zachary Michaels Date: Tue, 1 Jul 2014 10:55:41 -0400 Subject: [PATCH] Fix assert bug in base58 encode The previous implementation was almost certainly a typo. full_block_size is the maximum index in the encoded_block_sizes array, and size is used as an index in this array. So now 1 <= size <= full_block_size == 8 instead of 1 <= size <= sizeof(full_block_size) == size_of(size_t) == ? (maybe 4 on 32-bit systems!) --- src/common/base58.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/base58.cpp b/src/common/base58.cpp index 454c0db67..575279aa5 100644 --- a/src/common/base58.cpp +++ b/src/common/base58.cpp @@ -110,7 +110,7 @@ namespace tools void encode_block(const char* block, size_t size, char* res) { - assert(1 <= size && size <= sizeof(full_block_size)); + assert(1 <= size && size <= full_block_size); uint64_t num = uint_8be_to_64(reinterpret_cast(block), size); int i = static_cast(encoded_block_sizes[size]) - 1;