Skip to content

Commit

Permalink
fix: 32bit be decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Jul 23, 2023
1 parent 3549efa commit da390aa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.12)
if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif (POLICY CMP0048)
project(base16384 VERSION 2.2.3)
project(base16384 VERSION 2.2.4)

add_executable(base16384_b base16384.c)

Expand Down
6 changes: 5 additions & 1 deletion base1432.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,11 @@ int base16384_decode(const char* data, int dlen, char* buf, int blen) {
if(offset--) {
buf[i] = (sum & 0x0f000000) >> 20;
// 这里有读取越界
sum = vals[n];
#ifdef WORDS_BIGENDIAN
sum = __builtin_bswap32(vals[n]);
#else
sum = vals[n];
#endif
sum -= 0x0000004e;
buf[i++] |= (sum & 0x0000003c) >> 2;
if(offset--) {
Expand Down
2 changes: 1 addition & 1 deletion base16384.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ unsigned long get_start_ms() {
#endif

static void print_usage() {
puts("Copyright (c) 2022-2023 Fumiama Minamoto.\nBase16384 2.2.3 (May 18th 2023). Usage:");
puts("Copyright (c) 2022-2023 Fumiama Minamoto.\nBase16384 2.2.4 (July 23rd 2023). Usage:");
puts("base16384 [-edt] [inputfile] [outputfile]");
puts(" -e\t\tencode");
puts(" -d\t\tdecode");
Expand Down

0 comments on commit da390aa

Please sign in to comment.