src/delta-apply.c


Log

Author Commit Date CI Message
Patrick Steinhardt cf0396a5 2016-05-02T16:49:59 delta-apply: fix sign extension We compute offsets by executing `off |= (*delta++ << 24)` for multiple constants, where `off` is of type `size_t` and `delta` is of type `unsigned char`. The usual arithmetic conversions (see ISO C89 §3.2.1.5 "Usual arithmetic conversions") kick in here, causing us to promote both operands to `int` and then extending the result to an `unsigned long` when OR'ing it with `off`. The integer promotion to `int` may result in wrong size calculations for big values. Fix the issue by making the constants `unsigned long`, causing both operands to be promoted to `unsigned long`.
Carlos Martín Nieto 66633e83 2016-04-27T12:00:31 odb: avoid inflating the full delta to read the header When we read the header, we want to know the size and type of the object. We're currently inflating the full delta in order to read the first few bytes. This can mean hundreds of kB needlessly inflated for large objects. Instead use a packfile stream to read just enough so we can read the two varints in the header and avoid inflating most of the delta.
Edward Thomson f1453c59 2015-02-12T12:19:37 Make our overflow check look more like gcc/clang's Make our overflow checking look more like gcc and clang's, so that we can substitute it out with the compiler instrinsics on platforms that support it. This means dropping the ability to pass `NULL` as an out parameter. As a result, the macros also get updated to reflect this as well.
Edward Thomson 392702ee 2015-02-09T23:41:13 allocations: test for overflow of requested size Introduce some helper macros to test integer overflow from arithmetic and set error message appropriately.
Edward Thomson 359fc2d2 2013-01-08T17:07:25 update copyrights
David Michael Barr d1b6ea8a 2012-12-01T14:50:20 delta-apply: add git__delta_read_header
Vicent Martí e172cf08 2012-05-18T01:21:06 errors: Rename the generic return codes
Vicent Martí 3fbcac89 2012-05-02T19:56:38 Remove old and unused error codes
Carlos Martín Nieto 3aa351ea 2012-04-26T15:05:07 error handling: move the missing parts over to the new error handling
schu 5e0de328 2012-02-13T17:10:24 Update Copyright header Signed-off-by: schu <schu-github@schulog.org>
Vicent Marti 3286c408 2011-10-28T14:51:13 global: Properly use `git__` memory wrappers Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
Vicent Marti 87d9869f 2011-09-19T03:34:49 Tabify everything There were quite a few places were spaces were being used instead of tabs. Try to catch them all. This should hopefully not break anything. Except for `git blame`. Oh well.
Vicent Marti bb742ede 2011-09-19T01:54:32 Cleanup legal data 1. The license header is technically not valid if it doesn't have a copyright signature. 2. The COPYING file has been updated with the different licenses used in the project. 3. The full GPLv2 header in each file annoys me.
Jakob Pfender 4152a44b 2011-05-17T17:22:33 delta-apply.c: Move to new error handling mechanism
Jakob Pfender 21dcb75a 2011-05-17T17:21:00 delta-apply.c: Use GIT_ENOMEM instead of GIT_ERROR when allocating git__delta_apply used to return with a generic GIT_ERROR when allocating memory for the delta failed. Fix this to return GIT_ENOMEM.
Vicent Marti 44908fe7 2010-12-06T23:03:16 Change the library include file Libgit2 is now officially include as #include "<git2.h>" or indidividual files may be included as #include <git2/index.h> Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti f49a2e49 2010-09-19T03:21:06 Give object structures more descriptive names The 'git_obj' structure is now called 'git_rawobj', since it represents a raw object read from the ODB. The 'git_repository_object' structure is now called 'git_object', since it's the base object class for all objects. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Ramsay Jones e8a95256 2010-01-04T18:57:13 msvc: Fix some -W4 warnings Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones a9984a4e 2009-02-18T18:52:13 Fix some (digital-mars) compiler warnings In particular, conditional expressions which contain an assignment statement, where the expression type is not explicitly made to be boolean, elicits the following message: warning 2: possible unintended assignment Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 66a4bfac 2009-01-12T19:38:37 Fix a sparse "symbol not declared" warning In particular, the git__delta_apply() function has not been declared prior to it's definition. In order to suppress the warning, include the delta-apply.h header which provides the public interface. This ensures that the declaration and definition are consistent. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce c23841c8 2009-01-03T04:21:30 Add the binary delta apply algorithm for pack style deltas The git__delta_apply() function can be used to apply a Git style delta, such as those used in pack files or in git patch files, to recover the original object stream. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>