Skip to content

Commit

Permalink
Fix crash in NewFromEncodedNodeTree when passing in zero length string
Browse files Browse the repository at this point in the history
  • Loading branch information
Auburn committed Nov 5, 2022
1 parent 1fe20ed commit 11072bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CMakeList.txt : CMake project for FastNoise2
cmake_minimum_required(VERSION 3.7.1)

project(FastNoise2 VERSION 0.9.6)
project(FastNoise2 VERSION 0.9.7)
set(CMAKE_CXX_STANDARD 17)

message("FastNoise2 Arch: ${CMAKE_SYSTEM_PROCESSOR}")
Expand Down
5 changes: 3 additions & 2 deletions src/FastNoise/Base64.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ namespace FastNoise
};

size_t in_len = std::strlen( input );
if( in_len % 4 != 0 ) return {};

size_t out_len = in_len / 4 * 3;

if( out_len == 0 || in_len % 4 != 0 ) return {};

if( input[in_len - 1] == '=' ) out_len--;
if( input[in_len - 2] == '=' ) out_len--;

Expand Down

0 comments on commit 11072bc

Please sign in to comment.