@@ -10986,8 +10986,8 @@ tsk_table_collection_check_index_integrity(const tsk_table_collection_t *self)
1098610986 return ret ;
1098710987}
1098810988
10989- int TSK_WARN_UNUSED
10990- tsk_table_collection_compute_mutation_parents_no_integrity_check (
10989+ static int TSK_WARN_UNUSED
10990+ tsk_table_collection_compute_mutation_parents_to_array (
1099110991 const tsk_table_collection_t * self , tsk_id_t * mutation_parent )
1099210992{
1099310993 int ret = 0 ;
@@ -11110,10 +11110,8 @@ tsk_table_collection_check_mutation_parents(const tsk_table_collection_t *self)
1111011110 ret = tsk_trace_error (TSK_ERR_NO_MEMORY );
1111111111 goto out ;
1111211112 }
11113- tsk_memcpy (new_parents , mutations .parent , mutations .num_rows * sizeof (* new_parents ));
1111411113
11115- ret = tsk_table_collection_compute_mutation_parents_no_integrity_check (
11116- self , new_parents );
11114+ ret = tsk_table_collection_compute_mutation_parents_to_array (self , new_parents );
1111711115 if (ret != 0 ) {
1111811116 goto out ;
1111911117 }
@@ -12504,24 +12502,30 @@ tsk_table_collection_deduplicate_sites(
1250412502
1250512503int TSK_WARN_UNUSED
1250612504tsk_table_collection_compute_mutation_parents (
12507- tsk_table_collection_t * self , tsk_flags_t TSK_UNUSED ( options ) )
12505+ tsk_table_collection_t * self , tsk_flags_t options )
1250812506{
1250912507 int ret = 0 ;
12510- tsk_id_t num_trees ;
1251112508 const tsk_mutation_table_t mutations = self -> mutations ;
1251212509
12513- /* Set the mutation parent to TSK_NULL so that we don't use the
12514- * parent values we are about to write over. */
12515- tsk_memset (mutations .parent , 0xff , mutations .num_rows * sizeof (* mutations .parent ));
12516-
12517- num_trees = tsk_table_collection_check_integrity (self , TSK_CHECK_TREES );
12518- if (num_trees < 0 ) {
12519- ret = (int ) num_trees ;
12520- goto out ;
12510+ if (!(options & TSK_NO_CHECK_INTEGRITY )) {
12511+ /* Set the mutation parent to TSK_NULL so that we don't error
12512+ in the integrity check on data we're about to overwite.
12513+ */
12514+ tsk_memset (
12515+ mutations .parent , 0xff , mutations .num_rows * sizeof (* mutations .parent ));
12516+
12517+ /* Safe to cast here as we're not counting trees */
12518+ ret = (int ) tsk_table_collection_check_integrity (self , TSK_CHECK_TREES );
12519+ if (ret < 0 ) {
12520+ goto out ;
12521+ }
1252112522 }
1252212523
12523- ret = tsk_table_collection_compute_mutation_parents_no_integrity_check (
12524+ ret = tsk_table_collection_compute_mutation_parents_to_array (
1252412525 self , self -> mutations .parent );
12526+ if (ret != 0 ) {
12527+ goto out ;
12528+ }
1252512529
1252612530out :
1252712531 return ret ;
0 commit comments