summaryrefslogtreecommitdiff
path: root/src/zstream.c
Commit message (Collapse)AuthorAgeFilesLines
* giterr_set: consistent error messagesEdward Thomson2016-12-291-1/+1
| | | | | | | | Error messages should be sentence fragments, and therefore: 1. Should not begin with a capital letter, 2. Should not conclude with punctuation, and 3. Should not end a sentence and begin a new one
* use `giterr_set_str()` wherever possiblePranit Bauva2016-11-171-1/+1
| | | | | | | | | | `giterr_set()` is used when it is required to format a string, and since we don't really require it for this case, it is better to stick to `giterr_set_str()`. This also suppresses a warning(-Wformat-security) raised by the compiler. Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
* zstream: fail when asked to inflate garbageEdward Thomson2016-05-261-0/+5
| | | | | | | | When we are provided some input buffer (with a length) to inflate, and it contains more data than simply the deflated data, fail. zlib will helpfully tell us when it is done reading (via Z_STREAM_END), so if there is data leftover in the input buffer, fail lest we continually try to inflate it.
* zstream: offer inflating, `git_zstream_inflatebuf`Edward Thomson2016-05-261-7/+31
| | | | Introduce `git_zstream_inflatebuf` for simple uses.
* git_buf_grow_by: increase buf asize incrementallyEdward Thomson2015-02-121-2/+1
| | | | | Introduce `git_buf_grow_by` to incrementally increase the size of a `git_buf`, performing an overflow calculation on the growth.
* allocations: test for overflow of requested sizeEdward Thomson2015-02-121-0/+1
| | | | | Introduce some helper macros to test integer overflow from arithmetic and set error message appropriately.
* zstream: grow based on used memory rather than allocatedCarlos Martín Nieto2014-04-261-1/+1
| | | | | | | | | | | | | | | When deflating data, we might need to grow the buffer. Currently we add a guess on top of the currently-allocated buffer size. When we re-use the buffer, it already has some memory allocated; adding to that means that we always grow the buffer regardless of how much we need to use. Instead, increase on top of the currently-used size. This still leaves us with the allocated size of the largest object we compress, but it's a minor pain compared to unbounded growth. This fixes #2285.
* Defer zstream NUL termination to endRussell Belfer2014-01-301-2/+5
| | | | | And don't terminate if there isn't space for it (since it's binary data, it's not worth a reallocation).
* Expand zstream tests and fix off-by-one errorRussell Belfer2014-01-301-1/+2
|
* Reorganize zstream API and fix wrap problemsRussell Belfer2014-01-301-44/+102
| | | | | | | | There were some confusing issues mixing up the number of bytes written to the zstream output buffer with the number of bytes consumed from the zstream input. This reorganizes the zstream API and makes it easier to deflate an arbitrarily large input while still using a fixed size output.
* Fix write_object.XTao2014-01-261-2/+1
|
* Packbuilder contains its own zstreamEdward Thomson2014-01-141-0/+5
|
* Refactor zlib for easier deflate streamingEdward Thomson2014-01-141-0/+90