[Bug 8308] rsync: exclude.c:532: change_local_filter_dir: Assertion `dir_depth < 4096/2+1' failed

samba-bugs at samba.org samba-bugs at samba.org
Tue Apr 8 21:05:08 MDT 2014


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

--- Comment #4 from John <jss at mensa.org.au> 2014-04-09 03:05:08 UTC ---

from rsync.h:
    union file_extras {
        int32 num;
        uint32 unum;
    };
    #define REQ_EXTRA(f,ndx) ((union file_extras*)(f) - (ndx))
    #define F_DEPTH(f) REQ_EXTRA(f, 1)->num


from generator.c:
    struct file_struct *file = cur_flist->sorted[j];
    rprintf(FINFO, "Sizeof pointer to file struct = [%d]\n", sizeof (file) );
    f_name(file, fbuf);
    if (!(file->flags & FLAG_CONTENT_DIR)) {
    change_local_filter_dir(fbuf, strlen(fbuf), F_DEPTH(file));

When the program runs we see this from the code i added to generator.c:
    Sizeof pointer to file struct =[8]

So... my C is pretty rusty... and it is difficult to make any sense of this
code, but this looks like madness to me... you're using crazy macros to do
32bit pointer arithmetic on a 64-bit pointer.

ie when you run F_DEPTH(file), you're subtracting ndx, in this case 1, from the
file pointer, but you're doing so with a macro that casts the the pointer to
union file_extras* which is a 32bit pointer, not a 64bit one. so you're going
to end up subtracting 4 bytes from the pointer where you needed to subtract 8.

Madness!

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


More information about the rsync mailing list