Skip to content

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.

dbaarda added 2 commits May 31, 2020 16:46
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.

1 participant