|
|
|
@ -986,12 +986,12 @@ fn interpret_program(operations: &Vec<Operation>, queue: &mut Vec<String>, funct
|
|
|
|
|
if position >= arr.length
|
|
|
|
|
{
|
|
|
|
|
//return Err(format!("Attempted an out of bounds write for array {} ({} >= {}) at {}:{}", arr.name, position, arr.length, line, col));
|
|
|
|
|
return Err(String::from("Attempted array out-of-bounds access"));
|
|
|
|
|
return Err(String::from("Attempted array out-of-bounds access\n"));
|
|
|
|
|
}
|
|
|
|
|
if position < 0
|
|
|
|
|
{
|
|
|
|
|
//return Err(format!("Attempted an out of bounds write for array {} ({} < 0) at {}:{}", arr.name, position, line, col));
|
|
|
|
|
return Err(String::from("Attempted array out-of-bounds access"));
|
|
|
|
|
return Err(String::from("Attempted array out-of-bounds access\n"));
|
|
|
|
|
}
|
|
|
|
|
let data = queue.remove(0);
|
|
|
|
|
if debug
|
|
|
|
@ -1010,12 +1010,12 @@ fn interpret_program(operations: &Vec<Operation>, queue: &mut Vec<String>, funct
|
|
|
|
|
if position >= arr.length
|
|
|
|
|
{
|
|
|
|
|
//return Err(format!("Attempted an out of bounds read for array {} ({} >= {}) at {}:{}", arr.name, position, arr.length, line, col));
|
|
|
|
|
return Err(String::from("Attempted array out-of-bounds access"));
|
|
|
|
|
return Err(String::from("Attempted array out-of-bounds access\n"));
|
|
|
|
|
}
|
|
|
|
|
if position < 0
|
|
|
|
|
{
|
|
|
|
|
//return Err(format!("Attempted an out of bounds read for array {} ({} < 0) at {}:{}", arr.name, position, line, col));
|
|
|
|
|
return Err(String::from("Attempted array out-of-bounds access"));
|
|
|
|
|
return Err(String::from("Attempted array out-of-bounds access\n"));
|
|
|
|
|
}
|
|
|
|
|
queue.push(arr.data[position as usize].clone());
|
|
|
|
|
}
|
|
|
|
|