[Bug 1467] New: Hash table generation seems to be flawed

samba-bugs at samba.org samba-bugs at samba.org
Sat Jun 19 09:12:03 GMT 2004


https://bugzilla.samba.org/show_bug.cgi?id=1467

           Summary: Hash table generation seems to be flawed
           Product: rsync
           Version: 2.6.0
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: core
        AssignedTo: wayned at samba.org
        ReportedBy: ripper at internode.on.net
         QAContact: rsync-qa at samba.org


The following code is used to generate the hash table for matching. I believe 
there is a line missing that might lead to certain blocks being transmitted 
unnecessarily over the network.

static void build_hash_table(struct sum_struct *s)
{
        int i;

        if (!tag_table)
                tag_table = new_array(int, TABLESIZE);

        targets = new_array(struct target, s->count);
        if (!tag_table || !targets)
                out_of_memory("build_hash_table");

        for (i = 0; i < (int)s->count; i++) {
                targets[i].i = i;
                targets[i].t = gettag(s->sums[i].sum1);
        }

        qsort(targets,s->count,sizeof(targets[0]),(int (*)())compare_targets);

        for (i = 0; i < TABLESIZE; i++)
                tag_table[i] = NULL_TAG;

        for (i = s->count-1; i >= 0; i--)
                // ************** THE FOLLOWING LINE WAS MISSING **********
                if(tag_table[targets[i].t] == NULL_TAG || i < tag_table[targets
[i].t])
                        tag_table[targets[i].t] = i;

-- 
Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.


More information about the rsync mailing list