Bug 8333 - crash with hfs-compression.diff and possible fix
crash with hfs-compression.diff and possible fix
Status: RESOLVED FIXED
Product: rsync
Classification: Unclassified
Component: core
3.0.9
All Mac OS X
: P5 normal
: ---
Assigned To: Wayne Davison
Rsync QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-28 12:26 UTC by Martin Otte
Modified: 2011-08-01 05:57 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Otte 2011-07-28 12:26:03 UTC
Using the latest 3.0.9-pre1 with the hfs-compression patches, rsync crashed on the receiver side on files with hfs-compression (I used rsync -aHANXxuv --force-change --hfs-compression --fileflags).

The crash was occurring in routine rsync_xal_set in xattrs.c. Near line 900 of the patched xattrs.c, we have

                        memcpy(ptr + len, name, name_len);

At this part of the code, for hfs-compressed attributes it appears that ptr is set to the dummy value UNREAD_DATA (which is defined to be char *1,). This memcpy should clearly not be performed for hfs-compression, and rsync crashes.

I have temporarily got around this by adding:

                       if (ptr = UNREAD_DATA)
                               continue;

just before the invalid memcpy. This allows rsync to run properly, although I can't be sure that it is the proper solution.
Comment 1 Wayne Davison 2011-08-01 05:57:36 UTC
Thanks.  I've checked in a change that will fix the crash, and avoid any of the free() calls that might have been called on the UNREAD_DATA value.  I did not try to figure out the logic to know if the code needs to do something else other than skip that xattr.