libgit2/src
Carlos Martín Nieto 294c6f2964 http: make sure we can consume the data we request
The recv buffer (parse_buffer) and the buffer have independent sizes and
offsets. We try to fill in parse_buffer as much as possible before
passing it to the http parser. This is fine most of the time, but fails
us when the buffer is almost full.

In those situations, parse_buffer can have more data than we would be
able to put into the buffer (which may be getting full if we're towards
the end of a data sideband packet).

To work around this, we check if the space we have left on our buffer is
smaller than what could come from the network. If this happens, we make
parse_buffer think that it has as much space left as our buffer, so it
won't try to retrieve more data than we can deal with.

As the start of the data may no longer be at the start of the buffer, we
need to keep track of where it really starts (data_offset) and use that
in our calculations for the real size of the data we received from the
network.

This fixes #2518.
2014-08-16 22:21:12 +02:00
..
hash Add simple global shutdown hooks 2013-09-17 09:31:45 -07:00
transports http: make sure we can consume the data we request 2014-08-16 22:21:12 +02:00
unix Introduce some consistency in definition/declaration ordering 2014-08-05 20:52:00 +02:00
win32 Introduce some consistency in definition/declaration ordering 2014-08-05 20:52:00 +02:00
xdiff
array.h array: mark the array to grow as volatile 2014-07-25 08:25:41 +02:00
attr_file.c Improve checks for ignore containment 2014-05-06 12:41:26 -07:00
attr_file.h Improve checks for ignore containment 2014-05-06 12:41:26 -07:00
attr.c Minor fixes 2014-04-18 15:45:59 -07:00
attr.h Attribute file cache refactor 2014-04-17 14:56:41 -07:00
attrcache.c Merge pull request #2303 from jacquesg/mingw-lseek 2014-05-19 12:20:31 +02:00
attrcache.h Fix broken logic for attr cache invalidation 2014-04-17 15:04:41 -07:00
bitvec.h Address PR comments 2014-02-20 14:27:10 -08:00
blame_git.c Reset num_parents to 1 only for merge commits 2014-02-26 19:25:07 +01:00
blame_git.h Blame: minor cleanup 2013-09-25 14:40:19 -07:00
blame.c Make init_options fns use unsigned ints and macro 2014-05-02 09:21:33 -07:00
blame.h Improve GIT_EUSER handling 2013-12-11 10:57:49 -08:00
blob.c Increase binary detection len to 8k 2014-05-16 11:08:19 -07:00
blob.h Fix rename detection to use actual blob size 2013-07-25 12:27:39 -07:00
branch.c repository: introduce a convenience config snapshot method 2014-05-07 11:34:32 +02:00
branch.h branch: rename 'tracking' to 'upstream' 2013-03-30 15:45:57 +01:00
bswap.h update copyrights 2013-01-08 17:31:27 -06:00
buf_text.c Just put it all in buffer. 2014-07-16 13:34:25 -07:00
buf_text.h Just put it all in buffer. 2014-07-16 13:34:25 -07:00
buffer.c Introduce git_buf_decode_base64 2014-08-15 11:12:42 -04:00
buffer.h Introduce git_buf_decode_base64 2014-08-15 11:12:42 -04:00
cache.c util: It's called memzero 2013-06-12 21:10:33 +02:00
cache.h git_atomic_ssize for 64-bit atomics only on 64-bit platforms 2013-04-25 12:40:33 -05:00
cc-compat.h Include stdarg.h for the va_copy test 2014-02-24 21:56:08 -08:00
checkout.c Merge remote-tracking branch 'origin/master' into fix-git-status-list-new-unreadable-folder 2014-07-22 15:08:24 +10:00
checkout.h git_checkout_opts -> git_checkout_options 2014-03-06 09:44:51 -08:00
cherrypick.c git_cherry_pick -> git_cherrypick 2014-07-22 10:40:23 -04:00
clone.c Merge pull request #2471 from jacquesg/compatibility-cleanup 2014-08-07 18:00:57 +02:00
clone.h clone: add flags to override whether to perform a local clone 2014-05-28 15:40:22 +02:00
commit_list.c Replace pqueue with code from hashsig heap 2014-02-03 21:02:08 -08:00
commit_list.h Replace pqueue with code from hashsig heap 2014-02-03 21:02:08 -08:00
commit.c commit: safer commit creation with reference update 2014-04-30 00:41:37 +02:00
commit.h Introduce git_revert to revert a single commit 2013-12-02 16:57:41 -06:00
common.h Make init_options fns use unsigned ints and macro 2014-05-02 09:21:33 -07:00
config_cache.c Ignore core.safecrlf=warn until we have a warn infrastructure 2014-05-30 11:30:53 -05:00
config_file.c config: a multiline var can start immediately 2014-08-09 11:06:49 +02:00
config_file.h Make submodule refresh a bit smarter 2014-04-01 09:48:37 -07:00
config.c config: initialize the error 2014-05-30 13:06:34 +02:00
config.h Increase use of config snapshots 2014-05-13 16:32:27 -07:00
crlf.c Update text=auto / core.autocrlf=false behavior 2014-06-24 13:46:32 -04:00
date.c Introduce git__date_rfc2822_fmt. Allows for RFC2822 date headers 2014-04-11 21:55:35 +02:00
delta-apply.c update copyrights 2013-01-08 17:31:27 -06:00
delta-apply.h update copyrights 2013-01-08 17:31:27 -06:00
delta.c Fixed left shift size of int. 2013-12-08 01:50:10 -08:00
delta.h Fix warnings on Win64 build 2012-11-27 13:18:29 -08:00
diff_driver.c Increase binary detection len to 8k 2014-05-16 11:08:19 -07:00
diff_driver.h Initial take on builtin drivers with multiline 2014-01-24 10:43:05 -08:00
diff_file.c Start adding GIT_DELTA_UNREADABLE and GIT_STATUS_WT_UNREADABLE. 2014-05-20 23:57:40 +10:00
diff_file.h Add buffer to buffer diff and patch APIs 2014-02-27 14:13:22 -08:00
diff_patch.c Fix const-correctness of git_patch_get_delta, git_patch_num_hunks, git_patch_num_lines_in_hunk 2014-04-11 21:55:36 +02:00
diff_patch.h Rename diff objects and split patch.h 2013-10-11 14:51:54 -07:00
diff_print.c Introduce git_buf_decode_base64 2014-08-15 11:12:42 -04:00
diff_stats.c Don't scale diff stat when not needed 2014-05-12 10:28:45 -07:00
diff_tform.c Start adding GIT_DELTA_UNREADABLE and GIT_STATUS_WT_UNREADABLE. 2014-05-20 23:57:40 +10:00
diff_xdiff.c Remove converting user error to GIT_EUSER 2013-12-11 10:57:49 -08:00
diff_xdiff.h Reorganize diff and add basic diff driver 2013-06-10 10:10:39 -07:00
diff.c Merge remote-tracking branch 'origin/development' into fix-git-status-list-new-unreadable-folder 2014-06-04 15:36:28 -07:00
diff.h Remove trace / add git_diff_perfdata struct + api 2014-05-02 09:21:33 -07:00
errors.c Allow NULL error message prefix when class=GITERR_OS 2014-08-13 14:55:24 -04:00
fetch.c Don't reset need_pack 2014-03-30 19:08:56 +02:00
fetch.h Don't redefine the same callback types, their signatures may change 2014-04-21 11:28:49 +02:00
fetchhead.c fetchhead: deal with quotes in branch names 2014-04-24 14:08:29 +02:00
fetchhead.h update copyrights 2013-01-08 17:31:27 -06:00
filebuf.c filebuf: make unlocking atomic 2014-06-04 11:58:18 -07:00
filebuf.h move mode_t to filebuf_open instead of _commit 2013-11-04 22:33:05 -05:00
fileops.c fileops: allow linking files when copying directory structures 2014-05-28 15:40:22 +02:00
fileops.h fileops: allow linking files when copying directory structures 2014-05-28 15:40:22 +02:00
filter.c Merge pull request #2334 from libgit2/rb/fix-2333 2014-05-12 10:44:13 -07:00
filter.h Increase binary detection len to 8k 2014-05-16 11:08:19 -07:00
fnmatch.c Restore attributions for fnmatch 2014-05-19 14:39:45 +01:00
fnmatch.h Restore attributions for fnmatch 2014-05-19 14:39:45 +01:00
global.c Only create openssl_locks if thread support is enabled 2014-07-13 16:23:17 +02:00
global.h ssl: init everything all the time 2014-06-12 16:58:25 +02:00
graph.c graph: handle not finding a merge base gracefully 2014-04-08 16:52:20 +02:00
hash.c update copyrights 2013-01-08 17:31:27 -06:00
hash.h Add simple global shutdown hooks 2013-09-17 09:31:45 -07:00
hashsig.c Major rename detection changes 2013-07-31 16:40:42 -07:00
hashsig.h Refine pluggable similarity API 2013-02-20 15:09:41 -08:00
ident.c Bug fixes and cleanups 2013-09-17 09:31:46 -07:00
ignore.c Improve checks for ignore containment 2014-05-06 12:41:26 -07:00
ignore.h Improve checks for ignore containment 2014-05-06 12:41:26 -07:00
index.c index: check for valid filemodes on add 2014-05-22 16:01:02 +02:00
index.h Clean up index snapshot function naming 2014-04-17 14:43:46 -07:00
indexer.c Properly report failure when expanding a packfile 2014-07-09 14:12:30 -07:00
iterator.c Improve checks for ignore containment 2014-05-06 12:41:26 -07:00
iterator.h Improve checks for ignore containment 2014-05-06 12:41:26 -07:00
khash.h
map.h indexer: use mmap for writing 2014-05-17 01:39:43 +02:00
merge_file.c Cleanups 2014-03-31 13:31:01 -07:00
merge_file.h Introduce git_merge_file for consumers 2014-03-20 09:25:05 -07:00
merge.c Don't allow conflicts by default 2014-07-17 01:25:31 -04:00
merge.h git_checkout_index: checkout other indexes 2014-07-01 17:32:15 -04:00
message.c message: don't assume the comment char 2014-05-18 10:06:49 +02:00
message.h update copyrights 2013-01-08 17:31:27 -06:00
mwindow.c pack: clean up error returns 2014-06-25 21:35:58 +02:00
mwindow.h pack: clean up error returns 2014-06-25 21:35:58 +02:00
netops.c in_addr is defined in <Winsock2.h>, include before <ws2tcpip.h> 2014-07-06 09:22:24 +02:00
netops.h ssl: cargo-cult thread safety 2014-06-12 14:37:03 +02:00
notes.c index: rename an entry's id to 'id' 2014-01-25 08:15:44 +01:00
notes.h note: rename the id getter to git_note_id() 2014-01-24 11:18:51 +01:00
object_api.c object: haha 2013-04-30 13:19:02 +02:00
object.c object: fix a brace 2014-05-06 21:29:55 +02:00
object.h object: Explicitly define helper API methods for all obj types 2013-04-30 13:13:38 +02:00
odb_loose.c odb: ignore files in the objects dir 2014-05-05 16:34:18 +02:00
odb_mempack.c In-memory packing backend 2014-03-26 18:17:08 +01:00
odb_pack.c Share packs across repository instances 2014-06-23 21:50:36 +02:00
odb.c odb: clear backend errors on successful read 2014-05-23 06:01:57 +02:00
odb.h Create public filter object and use it 2013-09-17 09:30:06 -07:00
offmap.h pack: introduce a delta base cache 2013-01-11 16:55:37 +01:00
oid.c git_oid_fromstrn: Simplify the implementation and fix memory access issues 2014-03-07 15:52:27 +01:00
oid.h oid: Helper for old-school hashcmp 2013-08-14 10:34:07 +02:00
oidmap.h Add callback to git_objects_table 2013-04-22 16:51:40 +02:00
pack-objects.c Win32: Fix object::cache::threadmania test on x64 2014-06-07 12:51:48 -04:00
pack-objects.h Packbuilder contains its own zstream 2014-01-14 09:45:14 -08:00
pack.c pack: free the new pack struct if we fail to insert 2014-06-25 21:20:39 +02:00
pack.h Share packs across repository instances 2014-06-23 21:50:36 +02:00
path.c Don't report status on named pipes 2014-08-08 13:17:50 -07:00
path.h Merge pull request #2471 from jacquesg/compatibility-cleanup 2014-08-07 18:00:57 +02:00
pathspec.c Minor fixes 2014-04-18 15:45:59 -07:00
pathspec.h Add git_pathspec_match_diff API 2013-07-10 20:50:33 +02:00
pool.c Round up pool alloc sizes for alignment 2014-06-30 12:05:25 -07:00
pool.h Improved tree iterator internals 2013-03-14 13:40:15 -07:00
posix.c indexer: use mmap for writing 2014-05-17 01:39:43 +02:00
posix.h Cleanup portability/compatibility layer 2014-08-05 20:51:59 +02:00
pqueue.c Fix pqueue sort boundary condition bug 2014-03-12 11:21:55 -07:00
pqueue.h Convert pqueue to just be a git_vector 2014-02-04 10:01:37 -08:00
push.c Make init_options fns use unsigned ints and macro 2014-05-02 09:21:33 -07:00
push.h Initial Implementation of progress reports during push 2013-09-30 13:22:28 -04:00
refdb_fs.c refs: copy the packed refs on iteration 2014-06-02 17:50:30 +02:00
refdb_fs.h immutable references and a pluggable ref database 2013-03-07 11:01:52 -06:00
refdb.c Fix remaining init_options inconsistencies 2014-05-02 09:21:33 -07:00
refdb.h refs: placeholder conditional delete 2014-02-05 12:07:57 +01:00
reflog.c Align git_signature_dup. 2014-01-14 21:33:35 +01:00
reflog.h reflog: move the reflog implementation into refdb_fs 2013-10-02 06:53:24 +02:00
refs.c Refs: Introduce git_refname_t. 2014-05-30 14:30:30 +02:00
refs.h git_cherry_pick -> git_cherrypick 2014-07-22 10:40:23 -04:00
refspec.c refspec: support asterisks in the middle of a pattern 2014-07-04 18:00:20 +02:00
refspec.h refspec: git_refspec_parse() does not exist 2014-04-01 20:18:36 +02:00
remote.c git_remote_ls() should return an error if the transport is not available 2014-08-15 22:56:15 +02:00
remote.h Custom transport: minor cleanups 2014-08-14 08:52:20 -05:00
repo_template.h Make mode handling during init more like git 2013-02-27 13:44:15 -08:00
repository.c git_cherry_pick -> git_cherrypick 2014-07-22 10:40:23 -04:00
repository.h Increase use of config snapshots 2014-05-13 16:32:27 -07:00
reset.c Fix reset for staged deletes 2014-04-21 11:54:54 -07:00
revert.c git_checkout_index: checkout other indexes 2014-07-01 17:32:15 -04:00
revparse.c revparse: do look at all refs when matching text 2014-02-05 12:16:44 +01:00
revwalk.c revwalk: remove preallocation of the uninteresting commits 2014-07-24 17:52:28 +02:00
revwalk.h No need to find merge base. 2014-03-31 15:15:32 -07:00
settings.c settings: use git_buf for returning strings 2014-03-24 13:21:51 +01:00
sha1_lookup.c Backport @peff's fix for duplicates in sha1_lookup 2013-09-04 13:16:57 +02:00
sha1_lookup.h sha1_lookup: do not use the "experimental" lookup mode 2013-08-14 10:28:01 +02:00
signature.c repository: introduce a convenience config snapshot method 2014-05-07 11:34:32 +02:00
signature.h update copyrights 2013-01-08 17:31:27 -06:00
sortedcache.c Attribute file cache refactor 2014-04-17 14:56:41 -07:00
sortedcache.h Add stddef include for sortedcache 2013-08-28 11:20:47 -07:00
stash.c Make stash and checkout ignore contained repos 2014-04-22 15:23:43 -07:00
status.c Remove debug printfs. 2014-07-22 11:25:56 +10:00
status.h Rename diff objects and split patch.h 2013-10-11 14:51:54 -07:00
strmap.c config: get rid of a useless asignment 2013-08-12 11:40:57 +02:00
strmap.h Add diff threading tests and attr file cache locks 2014-04-17 14:43:45 -07:00
strnlen.h strnlen() is only available from Visual Studio 2005+ 2014-07-06 09:22:24 +02:00
submodule.c Be more careful with user-supplied buffers 2014-05-08 10:17:14 -07:00
submodule.h Make submodule refresh a bit smarter 2014-04-01 09:48:37 -07:00
sysdir.c Fix the issues in git__on_shutdown 2014-05-06 12:16:24 -07:00
sysdir.h Move system directory cache out of utils 2014-02-24 17:52:38 -08:00
tag.c Some coverity inspired cleanups 2014-05-13 15:54:23 -07:00
tag.h Simplify object table parse functions 2013-04-22 16:52:06 +02:00
thread-utils.c update copyrights 2013-01-08 17:31:27 -06:00
thread-utils.h Move yield to the tests and enable for FreeBSD 2014-07-03 05:55:02 +02:00
trace.c Remove trace / add git_diff_perfdata struct + api 2014-05-02 09:21:33 -07:00
trace.h Variadic macros is only available from Visual Studio 2005+ 2014-07-06 09:22:24 +02:00
transport.c Custom transport: minor cleanups 2014-08-14 08:52:20 -05:00
tree-cache.c Minor tree cache speedups 2014-04-17 14:43:46 -07:00
tree-cache.h Minor tree cache speedups 2014-04-17 14:43:46 -07:00
tree.c tree: free in error conditions 2014-06-25 21:25:44 +02:00
tree.h treentry: no need for manual size book-keeping 2014-06-10 15:14:13 +02:00
tsort.c Sorting function cleanup and MinGW fix 2013-03-11 16:43:58 -07:00
userdiff.h userdiff: update ada patterns 2014-04-08 18:46:56 -04:00
util.c qsort_r is only available from Visual Studio 2005+ 2014-07-06 09:22:24 +02:00
util.h Fix typo in timer normalization constants 2014-08-05 15:06:45 -07:00
vector.c Decouple index iterator sort from index 2014-04-17 14:43:45 -07:00
vector.h Some vector utility tweaks 2014-04-17 14:43:45 -07:00
zstream.c zstream: grow based on used memory rather than allocated 2014-04-26 18:04:43 +02:00
zstream.h Reorganize zstream API and fix wrap problems 2014-01-30 09:59:59 -08:00