The Samba-Bugzilla – Bug 8333
crash with hfs-compression.diff and possible fix
Last modified: 2011-08-01 05:57:36 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)
just before the invalid memcpy. This allows rsync to run properly, although I can't be sure that it is the proper solution.
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.