Skip to content

Commit b2e26fe

Browse files
committed
Fix guarding condition to avoid reading out of bound values in accessing M table variables
1 parent 4429239 commit b2e26fe

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

examples/ocaml/mvalue.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ let m_table_value_at_index (variable_array : m_array) (table_start : int)
114114
let offset = int_of_float index.value in
115115
match offset with
116116
| x when x < 0 -> m_zero
117-
| x when x > size -> m_undef
117+
| x when x >= size -> m_undef
118118
| _ -> Array.get variable_array (offset + table_start)
119119

120120
let m_max (x : m_value) (y : m_value) : m_value =

0 commit comments

Comments
 (0)