Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix patch bug for zero-length copies and improve bad copy_cb() handling. #206

Merged
merged 4 commits into from
May 31, 2020

Conversation

dbaarda
Copy link
Member

@dbaarda dbaarda commented May 31, 2020

Fix a bug which would make librsync patch hang for a corrupt delta containing a zero-length copy command. Patch will now fail returning RS_CORRUPT on encountering a zero length copy command.

Make rs_patch_s_copying() do assert() that copy_cb() didn't copy more data than requested so that debug builds highlight this API violation. Keep the backwards-compatible defensive behavior of only copying the amount requested for non-debug builds, but upgrade the (possibly disabled) trace about it to log warning. Fix the rs_trace() of "copy callback returned ..." to only output this trace if the copy_cb() failed.

Tidy rs_patch_s_literal() and rs_patch_s_copy() code for updating stats to make them consistent.

Add rs_warn() to trace.h to make it easier to log warnings.

Fix a bug which would make librsync patch hang for a corrupt delta containing
a zero-length copy command. Patch will now fail returning RS_CORRUPT on
encountering a zero length copy command.

Make rs_patch_s_copying() do assert() that copy_cb() didn't copy more data
than requested so that debug builds highlight this API violation. Keep the
backwards-compatible defensive behaviour of only copying the amount requested
for non-debug builds, but upgrade the (possibly disabled) trace about it to
log warning. Fix the rs_trace() of "copy callback returned ..." to only output
this trace if the copy_cb() failed.

Tidy rs_patch_s_literal() and rs_patch_s_copy() code for updating stats to
make them consistent.
@dbaarda dbaarda merged commit d6e4055 into librsync:master May 31, 2020
@dbaarda dbaarda deleted the opt/patch1 branch May 31, 2020 07:33
dbaarda added a commit to dbaarda/librsync that referenced this pull request Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant