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

Use single-byte delta literal commands for small literals. #120

Closed
dbaarda opened this issue Oct 11, 2017 · 1 comment
Closed

Use single-byte delta literal commands for small literals. #120

dbaarda opened this issue Oct 11, 2017 · 1 comment

Comments

@dbaarda
Copy link
Member

@dbaarda dbaarda commented Oct 11, 2017

I noticed that although prototab.c defines a heap of single byte literal commands we are never using them, instead always using RS_OP_LITERAL_N1 instead, which uses 2 bytes. This means small litterals with 64 or less bytes are using a 2 byte command instead of a single byte command.

We are both not emitting single byte literal commands, and also not correctly interpreting them. This means adding support for this will produce deltas that are not backwards compatible with older rdiff versions. Unfortunately the current handling of this will try to interpret the following literal data as an integer length of literal data, producing at best a logged error message and assert failure (asserts are disabled in release builds) before proceeding with corrupt data, maybe halting with RS_CORRUPT later, but possibly completing with corrupt results.

So adding support for this may require a bump in the delta magic to warn about this.

@dbaarda
Copy link
Member Author

@dbaarda dbaarda commented Sep 11, 2019

Actually, looking at the code a bit closer, I think we are correctly interpreting single-byte literal commands in patch.c, which means bumping the delta magic will not be required, and deltas that use them should work fine with older versions of librsync.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant