mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-25 14:41:32 +00:00
check index before accessing imports.globals
This commit is contained in:
@ -149,6 +149,11 @@ impl LocalBacking {
|
|||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
Initializer::GetGlobal(import_global_index) => {
|
Initializer::GetGlobal(import_global_index) => {
|
||||||
|
if import_global_index.index() >= imports.globals.len() {
|
||||||
|
return Err(vec![LinkError::Generic {
|
||||||
|
message: "incorrect global index for initializer".to_string(),
|
||||||
|
}]);
|
||||||
|
}
|
||||||
if let Value::I32(x) = imports.globals[import_global_index].get() {
|
if let Value::I32(x) = imports.globals[import_global_index].get() {
|
||||||
x as u32
|
x as u32
|
||||||
} else {
|
} else {
|
||||||
@ -205,6 +210,11 @@ impl LocalBacking {
|
|||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
Initializer::GetGlobal(import_global_index) => {
|
Initializer::GetGlobal(import_global_index) => {
|
||||||
|
if import_global_index.index() >= imports.globals.len() {
|
||||||
|
return Err(vec![LinkError::Generic {
|
||||||
|
message: "incorrect global index for initializer".to_string(),
|
||||||
|
}]);
|
||||||
|
}
|
||||||
if let Value::I32(x) = imports.globals[import_global_index].get() {
|
if let Value::I32(x) = imports.globals[import_global_index].get() {
|
||||||
x as u32
|
x as u32
|
||||||
} else {
|
} else {
|
||||||
@ -273,6 +283,11 @@ impl LocalBacking {
|
|||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
Initializer::GetGlobal(import_global_index) => {
|
Initializer::GetGlobal(import_global_index) => {
|
||||||
|
if import_global_index.index() >= imports.globals.len() {
|
||||||
|
return Err(vec![LinkError::Generic {
|
||||||
|
message: "incorrect global index for initializer".to_string(),
|
||||||
|
}]);
|
||||||
|
}
|
||||||
if let Value::I32(x) = imports.globals[import_global_index].get() {
|
if let Value::I32(x) = imports.globals[import_global_index].get() {
|
||||||
x as u32
|
x as u32
|
||||||
} else {
|
} else {
|
||||||
@ -326,6 +341,11 @@ impl LocalBacking {
|
|||||||
}]);
|
}]);
|
||||||
}
|
}
|
||||||
Initializer::GetGlobal(import_global_index) => {
|
Initializer::GetGlobal(import_global_index) => {
|
||||||
|
if import_global_index.index() >= imports.globals.len() {
|
||||||
|
return Err(vec![LinkError::Generic {
|
||||||
|
message: "incorrect global index for initializer".to_string(),
|
||||||
|
}]);
|
||||||
|
}
|
||||||
if let Value::I32(x) = imports.globals[import_global_index].get() {
|
if let Value::I32(x) = imports.globals[import_global_index].get() {
|
||||||
x as u32
|
x as u32
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user