@@ -119,8 +119,9 @@ void process_ROM_operations(Builder& builder,
119119 // The rom_table won't work with a constant read because the table may not be initialized
120120 ASSERT (op.index .q_l != 0 );
121121
122+ // In case of invalid witness assignment, we set the value of index value to zero to not hit out of bound in
123+ // ROM table
122124 if (!has_valid_witness_assignments) {
123- // If witness are not assigned, we set the index value to 0
124125 builder.set_variable (index.witness_index , 0 );
125126 }
126127 value.assert_equal (table[index]);
@@ -140,9 +141,9 @@ void process_RAM_operations(Builder& builder,
140141 for (auto & op : constraint.trace ) {
141142 field_ct value = poly_to_field_ct (op.value , builder);
142143 field_ct index = poly_to_field_ct (op.index , builder);
143-
144+ // In case of invalid witness assignment, we set the value of index value to zero to not hit out of bound in
145+ // RAM table
144146 if (!has_valid_witness_assignments) {
145- // If witness are not assigned, we set the index value to 0
146147 builder.set_variable (index.witness_index , 0 );
147148 }
148149
@@ -174,8 +175,9 @@ void process_call_data_operations(Builder& builder,
174175 BB_ASSERT_EQ (op.access_type , 0 );
175176 field_ct value = poly_to_field_ct (op.value , builder);
176177 field_ct index = poly_to_field_ct (op.index , builder);
178+ // In case of invalid witness assignment, we set the value of index value to zero to not hit out of bound in
179+ // calldata-array
177180 if (!has_valid_witness_assignments) {
178- // If witness are not assigned, we set the index value to 0
179181 builder.set_variable (index.witness_index , 0 );
180182 }
181183 value.assert_equal (calldata_array[index]);
0 commit comments