Fix issue of wasm/aot file malformed format (#853)

Fix possible integer overflow unchecked issue when checking
wasm/aot file format.
This commit is contained in:
Javan
2021-11-30 20:47:42 +08:00
committed by GitHub
parent 8d1c56bda4
commit 212810bc2f
3 changed files with 10 additions and 14 deletions

View File

@ -90,7 +90,7 @@ static bool
check_buf(const uint8 *buf, const uint8 *buf_end, uint32 length,
char *error_buf, uint32 error_buf_size)
{
if (buf + length > buf_end) {
if (buf + length < buf || buf + length > buf_end) {
set_error_buf(error_buf, error_buf_size, "unexpect end");
return false;
}