From 0234a4129ad45a934cce6894508e49ad0e139ee2 Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Mon, 18 Sep 2023 22:15:37 -0400 Subject: [PATCH] do not perform arithmetic on nullptr --- libraries/wasm-jit/Include/Inline/Serialization.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/wasm-jit/Include/Inline/Serialization.h b/libraries/wasm-jit/Include/Inline/Serialization.h index 7b0933339c..87eec16d72 100644 --- a/libraries/wasm-jit/Include/Inline/Serialization.h +++ b/libraries/wasm-jit/Include/Inline/Serialization.h @@ -35,7 +35,7 @@ namespace Serialization // Advances the stream cursor by numBytes, and returns a pointer to the previous stream cursor. inline U8* advance(Uptr numBytes) { - if(next + numBytes > end) { extendBuffer(numBytes); } + if(next == nullptr || next + numBytes > end) { extendBuffer(numBytes); } WAVM_ASSERT_THROW(next + numBytes <= end); U8* data = next;