1
0
mirror of https://github.com/git/git.git synced 2024-10-20 09:59:05 +02:00
git/builtin
Jeff King 953aa54e1a pack-objects: clamp negative window size to 0
A negative window size makes no sense, and the code in find_deltas() is
not prepared to handle it. If you pass "-1", for example, we end up
generate a 0-length array of "struct unpacked", but our loop assumes it
has at least one entry in it (and we end up reading garbage memory).

We could complain to the user about this, but it's more forgiving to
just clamp it to 0, which means "do not find any deltas at all". The
0-case is already tested earlier in the script, so we'll make sure this
does the same thing.

Reported-by: Yiyuan guo <yguoaz@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-05-03 14:29:27 +09:00
..
add.c add: ensure full index 2021-04-14 13:46:48 -07:00
am.c builtin/*: update usage format 2021-01-06 15:10:49 -08:00
annotate.c
apply.c
archive.c
bisect--helper.c Merge branch 'jk/bisect-peel-tag-fix' 2021-03-19 15:25:37 -07:00
blame.c Merge branch 'rs/blame-optim' 2021-02-25 16:43:29 -08:00
branch.c Merge branch 'ph/use-delete-refs' 2021-02-05 16:40:45 -08:00
bugreport.c builtin/bugreport.c: use thread-safe localtime_r() 2020-12-01 13:05:37 -08:00
bundle.c
cat-file.c
check-attr.c
check-ignore.c
check-mailmap.c shortlog: remove unused(?) "repo-abbrev" feature 2021-01-12 14:04:42 -08:00
check-ref-format.c
checkout--worker.c parallel-checkout: make it truly parallel 2021-04-19 11:57:05 -07:00
checkout-index.c Merge branch 'ds/sparse-index-protections' 2021-04-30 13:50:26 +09:00
checkout.c Merge branch 'ds/sparse-index-protections' 2021-04-30 13:50:26 +09:00
clean.c use CALLOC_ARRAY 2021-03-13 16:00:09 -08:00
clone.c Merge branch 'll/clone-reject-shallow' 2021-04-08 13:23:25 -07:00
column.c column, range-diff: downcase option description 2021-03-29 14:06:08 -07:00
commit-graph.c builtin/*: update usage format 2021-01-06 15:10:49 -08:00
commit-tree.c
commit.c Merge branch 'ds/sparse-index-protections' 2021-04-30 13:50:26 +09:00
config.c config: implement --fixed-value with --get* 2020-11-25 14:43:48 -08:00
count-objects.c
credential-cache--daemon.c unix-socket: add backlog size option to unix_stream_listen() 2021-03-15 14:32:51 -07:00
credential-cache.c unix-socket: disallow chdir() when creating unix domain sockets 2021-03-15 14:32:51 -07:00
credential-store.c crendential-store: use timeout when locking file 2020-11-25 12:30:18 -08:00
credential.c credential: load default config 2020-10-16 12:30:45 -07:00
describe.c refs: switch peel_ref() to peel_iterated_oid() 2021-01-21 15:51:31 -08:00
diff-files.c Merge branch 'jc/diffcore-rotate' 2021-02-25 16:43:30 -08:00
diff-index.c Merge branch 'jc/diffcore-rotate' 2021-02-25 16:43:30 -08:00
diff-tree.c Merge branch 'jc/diffcore-rotate' 2021-02-25 16:43:30 -08:00
diff.c Merge branch 'jc/diffcore-rotate' 2021-02-25 16:43:30 -08:00
difftool.c Merge branch 'ds/sparse-index-protections' 2021-04-30 13:50:26 +09:00
env--helper.c assert PARSE_OPT_NONEG in parse-options callbacks 2020-09-30 12:53:47 -07:00
fast-export.c builtin/*: update usage format 2021-01-06 15:10:49 -08:00
fast-import.c use CALLOC_ARRAY 2021-03-13 16:00:09 -08:00
fetch-pack.c connect, transport: encapsulate arg in struct 2021-02-05 13:49:54 -08:00
fetch.c fetch: add --prefetch option 2021-04-16 13:36:55 -07:00
fmt-merge-msg.c
for-each-ref.c ref-filter: move ref_sorting flags to a bitfield 2021-01-07 15:13:21 -08:00
for-each-repo.c for-each-repo: do nothing on empty config 2021-01-07 19:12:02 -08:00
fsck.c Merge branch 'ds/sparse-index-protections' 2021-04-30 13:50:26 +09:00
gc.c maintenance: respect remote.*.skipFetchAll 2021-04-16 13:36:55 -07:00
get-tar-commit-id.c
grep.c Merge branch 'ds/sparse-index-protections' 2021-04-30 13:50:26 +09:00
hash-object.c
help.c
index-pack.c Merge branch 'ab/fsck-api-cleanup' 2021-04-07 16:54:09 -07:00
init-db.c Merge branch 'ah/plugleaks' 2021-04-07 16:54:08 -07:00
interpret-trailers.c
log.c Merge branch 'so/log-diff-merge' 2021-04-30 13:50:26 +09:00
ls-files.c ls-files: ensure full index 2021-04-14 13:47:17 -07:00
ls-remote.c Merge branch 'ah/plugleaks' 2021-04-07 16:54:08 -07:00
ls-tree.c tree.h API: simplify read_tree_recursive() signature 2021-03-20 16:09:26 -07:00
mailinfo.c
mailsplit.c
merge-base.c
merge-file.c
merge-index.c merge-index: ensure full index 2021-04-14 13:47:21 -07:00
merge-ours.c
merge-recursive.c
merge-tree.c merge-base, xdiff: zero out xpparam_t structures 2020-10-20 12:53:26 -07:00
merge.c use CALLOC_ARRAY 2021-03-13 16:00:09 -08:00
mktag.c fsck.c: add an fsck_set_msg_type() API that takes enums 2021-03-28 19:03:10 -07:00
mktree.c
multi-pack-index.c midx: allow marking a pack as preferred 2021-04-01 13:07:37 -07:00
mv.c git mv foo FOO ; git mv foo bar gave an assert 2021-03-03 17:07:12 -08:00
name-rev.c oid_pos(): access table through const pointers 2021-01-28 12:03:26 -08:00
notes.c use CALLOC_ARRAY 2021-03-13 16:00:09 -08:00
pack-objects.c pack-objects: clamp negative window size to 0 2021-05-03 14:29:27 +09:00
pack-redundant.c use CALLOC_ARRAY 2021-03-13 16:00:09 -08:00
pack-refs.c
patch-id.c
prune-packed.c
prune.c
pull.c pull: display default warning only when non-ff 2020-12-15 17:39:42 -08:00
push.c Merge branch 'jc/push-delete-nothing' 2021-02-25 16:43:33 -08:00
range-diff.c column, range-diff: downcase option description 2021-03-29 14:06:08 -07:00
read-tree.c
rebase.c Merge branch 'en/ort-readiness' 2021-04-16 13:53:34 -07:00
receive-pack.c Merge branch 'rs/calloc-array' 2021-03-19 15:25:38 -07:00
reflog.c reflog expire --stale-fix: be generous about missing objects 2021-02-11 09:21:52 -08:00
remote-ext.c
remote-fd.c
remote.c Merge branch 'ah/plugleaks' 2021-04-07 16:54:08 -07:00
repack.c Merge branch 'tb/reverse-midx' 2021-04-08 13:23:25 -07:00
replace.c
rerere.c
reset.c reset: free instead of leaking unneeded ref 2021-03-14 15:57:59 -07:00
rev-list.c rev-list: add --disk-usage option for calculating disk usage 2021-02-11 09:57:55 -08:00
rev-parse.c rev-parse: add option for absolute or relative path formatting 2020-12-12 23:35:51 -08:00
revert.c sequencer: fix edit handling for cherry-pick and revert messages 2021-03-31 14:10:50 -07:00
rm.c rm: ensure full index 2021-04-14 13:47:24 -07:00
send-pack.c push: parse and set flag for "--force-if-includes" 2020-10-03 09:59:19 -07:00
shortlog.c Merge branch 'ab/mailmap' 2021-01-25 14:19:19 -08:00
show-branch.c
show-index.c
show-ref.c refs: switch peel_ref() to peel_iterated_oid() 2021-01-21 15:51:31 -08:00
sparse-checkout.c Merge branch 'ds/sparse-index-protections' 2021-04-30 13:50:26 +09:00
stash.c Merge branch 'ds/sparse-index-protections' 2021-04-30 13:50:26 +09:00
stripspace.c
submodule--helper.c Merge branch 'tb/precompose-prefix-too' 2021-02-12 14:21:04 -08:00
symbolic-ref.c symbolic-ref: don't leak shortened refname in check_symref() 2021-03-14 15:57:59 -07:00
tag.c Merge branch 'js/params-vs-args' 2021-02-25 16:43:32 -08:00
unpack-file.c
unpack-objects.c Merge branch 'ab/fsck-api-cleanup' 2021-04-07 16:54:09 -07:00
update-index.c update-index: ensure full index 2021-04-14 13:47:29 -07:00
update-ref.c update-ref: disallow "start" for ongoing transactions 2020-11-16 13:44:01 -08:00
update-server-info.c
upload-archive.c
upload-pack.c
var.c
verify-commit.c
verify-pack.c
verify-tag.c
worktree.c worktree: fix leak in dwim_branch() 2021-03-14 15:57:59 -07:00
write-tree.c