ncanceill / frag_find

Hash-based carver tool
GNU General Public License v2.0
0 stars 0 forks source link

Bug report: filemap reporting has side-effects on masters Bloom filter #2

Open ncanceill opened 11 years ago

ncanceill commented 11 years ago

Working on it atm, standby...

ncanceill commented 11 years ago

Seems it comes from a side-effect of lazy evaluation in the add_block_hash() function, because an additional query is sent to the bloom filter in order to check for previous appearance.

    if(opt_raw && b.query(md5.digest)){
    cout << "Input file block " << blocknumber << "appears previously at ";;
    for(blocklist_t::const_iterator i = this->md5map[md5].begin();
        i!=this->md5map[md5].end();
        i++){
        printf("%"PRId64" ",*i);
    }
    printf("\n");
    }

Side-effect occurs in the nsrl_bloom_query() function because it increments hits upon each query.

    /* All of the bits were set; hash must be in the bloom filter */
    if(b->debug>1) putchar('\n');
    b->hits++;
ncanceill commented 11 years ago

Extending API by pseudo-overloading seems to work, waiting for simsong/frag_find#1 to be pulled first.