mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-11 07:18:44 +00:00
[Wasm] Add missing EOF checks for floats
Adds the same checks we already do for ints to floats. Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8698 llvm-svn: 341216
This commit is contained in:
parent
a7d0550d67
commit
318b9247d1
@ -82,6 +82,8 @@ static uint32_t readUint32(WasmObjectFile::ReadContext &Ctx) {
|
||||
}
|
||||
|
||||
static int32_t readFloat32(WasmObjectFile::ReadContext &Ctx) {
|
||||
if (Ctx.Ptr + 4 > Ctx.End)
|
||||
report_fatal_error("EOF while reading float64");
|
||||
int32_t Result = 0;
|
||||
memcpy(&Result, Ctx.Ptr, sizeof(Result));
|
||||
Ctx.Ptr += sizeof(Result);
|
||||
@ -89,6 +91,8 @@ static int32_t readFloat32(WasmObjectFile::ReadContext &Ctx) {
|
||||
}
|
||||
|
||||
static int64_t readFloat64(WasmObjectFile::ReadContext &Ctx) {
|
||||
if (Ctx.Ptr + 8 > Ctx.End)
|
||||
report_fatal_error("EOF while reading float64");
|
||||
int64_t Result = 0;
|
||||
memcpy(&Result, Ctx.Ptr, sizeof(Result));
|
||||
Ctx.Ptr += sizeof(Result);
|
||||
|
Loading…
x
Reference in New Issue
Block a user