attr: ignore overly large gitattributes files

Similar as with the preceding commit, start ignoring gitattributes files
that are overly large to protect us against out-of-bounds reads and
writes caused by integer overflows. Unfortunately, we cannot just define
"overly large" in terms of any preexisting limits in the codebase.

Instead, we choose a very conservative limit of 100MB. This is plenty of
room for specifying gitattributes, and incidentally it is also the limit
for blob sizes for GitHub. While we don't want GitHub to dictate limits
here, it is still sensible to use this fact for an informed decision
given that it is hosting a huge set of repositories. Furthermore, over
at GitLab we scanned a subset of repositories for their root-level
attribute files. We found that 80% of them have a gitattributes file
smaller than 100kB, 99.99% have one smaller than 1MB, and only a single
repository had one that was almost 3MB in size. So enforcing a limit of
100MB seems to give us ample of headroom.

With this limit in place we can be reasonably sure that there is no easy
way to exploit the gitattributes file via integer overflows anymore.
Furthermore, it protects us against resource exhaustion caused by
allocating the in-memory data structures required to represent the
parsed attributes.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 files changed
tree: 2d9a9379e7d94be5d8ad773466c90a76b79034d5
  1. .github/
  2. block-sha1/
  3. builtin/
  4. ci/
  5. compat/
  6. contrib/
  7. Documentation/
  8. ewah/
  9. git-gui/
  10. gitk-git/
  11. gitweb/
  12. mergetools/
  13. negotiator/
  14. perl/
  15. po/
  16. ppc/
  17. refs/
  18. sha1dc/
  19. sha256/
  20. t/
  21. templates/
  22. trace2/
  23. vcs-svn/
  24. xdiff/
  25. .cirrus.yml
  26. .clang-format
  27. .editorconfig
  28. .gitattributes
  29. .gitignore
  30. .gitmodules
  31. .mailmap
  32. .travis.yml
  33. .tsan-suppressions
  34. abspath.c
  35. aclocal.m4
  36. add-interactive.c
  37. add-interactive.h
  38. add-patch.c
  39. advice.c
  40. advice.h
  41. alias.c
  42. alias.h
  43. alloc.c
  44. alloc.h
  45. apply.c
  46. apply.h
  47. archive-tar.c
  48. archive-zip.c
  49. archive.c
  50. archive.h
  51. attr.c
  52. attr.h
  53. banned.h
  54. base85.c
  55. bisect.c
  56. bisect.h
  57. blame.c
  58. blame.h
  59. blob.c
  60. blob.h
  61. bloom.c
  62. bloom.h
  63. branch.c
  64. branch.h
  65. builtin.h
  66. bulk-checkin.c
  67. bulk-checkin.h
  68. bundle.c
  69. bundle.h
  70. cache-tree.c
  71. cache-tree.h
  72. cache.h
  73. chdir-notify.c
  74. chdir-notify.h
  75. check-builtins.sh
  76. check_bindir
  77. checkout.c
  78. checkout.h
  79. CODE_OF_CONDUCT.md
  80. color.c
  81. color.h
  82. column.c
  83. column.h
  84. combine-diff.c
  85. command-list.txt
  86. commit-graph.c
  87. commit-graph.h
  88. commit-reach.c
  89. commit-reach.h
  90. commit-slab-decl.h
  91. commit-slab-impl.h
  92. commit-slab.h
  93. commit.c
  94. commit.h
  95. common-main.c
  96. config.c
  97. config.h
  98. config.mak.dev
  99. config.mak.in
  100. config.mak.uname
  101. configure.ac
  102. connect.c
  103. connect.h
  104. connected.c
  105. connected.h
  106. convert.c
  107. convert.h
  108. copy.c
  109. COPYING
  110. credential.c
  111. credential.h
  112. csum-file.c
  113. csum-file.h
  114. ctype.c
  115. daemon.c
  116. date.c
  117. decorate.c
  118. decorate.h
  119. delta-islands.c
  120. delta-islands.h
  121. delta.h
  122. detect-compiler
  123. diff-delta.c
  124. diff-lib.c
  125. diff-no-index.c
  126. diff.c
  127. diff.h
  128. diffcore-break.c
  129. diffcore-delta.c
  130. diffcore-order.c
  131. diffcore-pickaxe.c
  132. diffcore-rename.c
  133. diffcore.h
  134. dir-iterator.c
  135. dir-iterator.h
  136. dir.c
  137. dir.h
  138. editor.c
  139. entry.c
  140. environment.c
  141. exec-cmd.c
  142. exec-cmd.h
  143. fetch-negotiator.c
  144. fetch-negotiator.h
  145. fetch-pack.c
  146. fetch-pack.h
  147. fmt-merge-msg.c
  148. fmt-merge-msg.h
  149. fsck.c
  150. fsck.h
  151. fsmonitor.c
  152. fsmonitor.h
  153. fuzz-commit-graph.c
  154. fuzz-pack-headers.c
  155. fuzz-pack-idx.c
  156. generate-cmdlist.sh
  157. generate-configlist.sh
  158. gettext.c
  159. gettext.h
  160. git-add--interactive.perl
  161. git-archimport.perl
  162. git-bisect.sh
  163. git-compat-util.h
  164. git-cvsexportcommit.perl
  165. git-cvsimport.perl
  166. git-cvsserver.perl
  167. git-difftool--helper.sh
  168. git-filter-branch.sh
  169. git-instaweb.sh
  170. git-merge-octopus.sh
  171. git-merge-one-file.sh
  172. git-merge-resolve.sh
  173. git-mergetool--lib.sh
  174. git-mergetool.sh
  175. git-p4.py
  176. git-quiltimport.sh
  177. git-rebase--preserve-merges.sh
  178. git-request-pull.sh
  179. git-send-email.perl
  180. git-sh-i18n.sh
  181. git-sh-setup.sh
  182. git-submodule.sh
  183. git-svn.perl
  184. GIT-VERSION-GEN
  185. git-web--browse.sh
  186. git.c
  187. git.rc
  188. gpg-interface.c
  189. gpg-interface.h
  190. graph.c
  191. graph.h
  192. grep.c
  193. grep.h
  194. hash.h
  195. hashmap.c
  196. hashmap.h
  197. help.c
  198. help.h
  199. hex.c
  200. http-backend.c
  201. http-fetch.c
  202. http-push.c
  203. http-walker.c
  204. http.c
  205. http.h
  206. ident.c
  207. imap-send.c
  208. INSTALL
  209. iterator.h
  210. json-writer.c
  211. json-writer.h
  212. khash.h
  213. kwset.c
  214. kwset.h
  215. levenshtein.c
  216. levenshtein.h
  217. LGPL-2.1
  218. line-log.c
  219. line-log.h
  220. line-range.c
  221. line-range.h
  222. linear-assignment.c
  223. linear-assignment.h
  224. list-objects-filter-options.c
  225. list-objects-filter-options.h
  226. list-objects-filter.c
  227. list-objects-filter.h
  228. list-objects.c
  229. list-objects.h
  230. list.h
  231. ll-merge.c
  232. ll-merge.h
  233. lockfile.c
  234. lockfile.h
  235. log-tree.c
  236. log-tree.h
  237. ls-refs.c
  238. ls-refs.h
  239. mailinfo.c
  240. mailinfo.h
  241. mailmap.c
  242. mailmap.h
  243. Makefile
  244. match-trees.c
  245. mem-pool.c
  246. mem-pool.h
  247. merge-blobs.c
  248. merge-blobs.h
  249. merge-ort-wrappers.c
  250. merge-ort-wrappers.h
  251. merge-ort.c
  252. merge-ort.h
  253. merge-recursive.c
  254. merge-recursive.h
  255. merge.c
  256. mergesort.c
  257. mergesort.h
  258. midx.c
  259. midx.h
  260. name-hash.c
  261. notes-cache.c
  262. notes-cache.h
  263. notes-merge.c
  264. notes-merge.h
  265. notes-utils.c
  266. notes-utils.h
  267. notes.c
  268. notes.h
  269. object-store.h
  270. object.c
  271. object.h
  272. oid-array.c
  273. oid-array.h
  274. oidmap.c
  275. oidmap.h
  276. oidset.c
  277. oidset.h
  278. pack-bitmap-write.c
  279. pack-bitmap.c
  280. pack-bitmap.h
  281. pack-check.c
  282. pack-objects.c
  283. pack-objects.h
  284. pack-revindex.c
  285. pack-revindex.h
  286. pack-write.c
  287. pack.h
  288. packfile.c
  289. packfile.h
  290. pager.c
  291. parse-options-cb.c
  292. parse-options.c
  293. parse-options.h
  294. patch-delta.c
  295. patch-ids.c
  296. patch-ids.h
  297. path.c
  298. path.h
  299. pathspec.c
  300. pathspec.h
  301. pkt-line.c
  302. pkt-line.h
  303. preload-index.c
  304. pretty.c
  305. pretty.h
  306. prio-queue.c
  307. prio-queue.h
  308. progress.c
  309. progress.h
  310. promisor-remote.c
  311. promisor-remote.h
  312. prompt.c
  313. prompt.h
  314. protocol.c
  315. protocol.h
  316. prune-packed.c
  317. prune-packed.h
  318. quote.c
  319. quote.h
  320. range-diff.c
  321. range-diff.h
  322. reachable.c
  323. reachable.h
  324. read-cache.c
  325. README.md
  326. rebase-interactive.c
  327. rebase-interactive.h
  328. rebase.c
  329. rebase.h
  330. ref-filter.c
  331. ref-filter.h
  332. reflog-walk.c
  333. reflog-walk.h
  334. refs.c
  335. refs.h
  336. refspec.c
  337. refspec.h
  338. remote-curl.c
  339. remote.c
  340. remote.h
  341. replace-object.c
  342. replace-object.h
  343. repo-settings.c
  344. repository.c
  345. repository.h
  346. rerere.c
  347. rerere.h
  348. reset.c
  349. reset.h
  350. resolve-undo.c
  351. resolve-undo.h
  352. revision.c
  353. revision.h
  354. run-command.c
  355. run-command.h
  356. send-pack.c
  357. send-pack.h
  358. sequencer.c
  359. sequencer.h
  360. serve.c
  361. serve.h
  362. server-info.c
  363. setup.c
  364. sh-i18n--envsubst.c
  365. sha1-file.c
  366. sha1-lookup.c
  367. sha1-lookup.h
  368. sha1-name.c
  369. sha1dc_git.c
  370. sha1dc_git.h
  371. shallow.c
  372. shallow.h
  373. shell.c
  374. shortlog.h
  375. sideband.c
  376. sideband.h
  377. sigchain.c
  378. sigchain.h
  379. split-index.c
  380. split-index.h
  381. stable-qsort.c
  382. strbuf.c
  383. strbuf.h
  384. streaming.c
  385. streaming.h
  386. string-list.c
  387. string-list.h
  388. strmap.c
  389. strmap.h
  390. strvec.c
  391. strvec.h
  392. sub-process.c
  393. sub-process.h
  394. submodule-config.c
  395. submodule-config.h
  396. submodule.c
  397. submodule.h
  398. symlinks.c
  399. tag.c
  400. tag.h
  401. tar.h
  402. tempfile.c
  403. tempfile.h
  404. thread-utils.c
  405. thread-utils.h
  406. tmp-objdir.c
  407. tmp-objdir.h
  408. trace.c
  409. trace.h
  410. trace2.c
  411. trace2.h
  412. trailer.c
  413. trailer.h
  414. transport-helper.c
  415. transport-internal.h
  416. transport.c
  417. transport.h
  418. tree-diff.c
  419. tree-walk.c
  420. tree-walk.h
  421. tree.c
  422. tree.h
  423. unicode-width.h
  424. unimplemented.sh
  425. unix-socket.c
  426. unix-socket.h
  427. unpack-trees.c
  428. unpack-trees.h
  429. upload-pack.c
  430. upload-pack.h
  431. url.c
  432. url.h
  433. urlmatch.c
  434. urlmatch.h
  435. usage.c
  436. userdiff.c
  437. userdiff.h
  438. utf8.c
  439. utf8.h
  440. varint.c
  441. varint.h
  442. version.c
  443. version.h
  444. versioncmp.c
  445. walker.c
  446. walker.h
  447. wildmatch.c
  448. wildmatch.h
  449. worktree.c
  450. worktree.h
  451. wrap-for-bin.sh
  452. wrapper.c
  453. write-or-die.c
  454. ws.c
  455. wt-status.c
  456. wt-status.h
  457. xdiff-interface.c
  458. xdiff-interface.h
  459. zlib.c
README.md

Build status

Git - fast, scalable, distributed revision control system

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

Git is an Open Source project covered by the GNU General Public License version 2 (some parts of it are under different licenses, compatible with the GPLv2). It was originally written by Linus Torvalds with help of a group of hackers around the net.

Please read the file INSTALL for installation instructions.

Many Git online resources are accessible from https://git-scm.com/ including full documentation and Git related tools.

See Documentation/gittutorial.txt to get started, then see Documentation/giteveryday.txt for a useful minimum set of commands, and Documentation/git-<commandname>.txt for documentation of each command. If git has been correctly installed, then the tutorial can also be read with man gittutorial or git help tutorial, and the documentation of each command with man git-<commandname> or git help <commandname>.

CVS users may also want to read Documentation/gitcvs-migration.txt (man gitcvs-migration or git help cvs-migration if git is installed).

The user discussion and development of Git take place on the Git mailing list -- everyone is welcome to post bug reports, feature requests, comments and patches to git@vger.kernel.org (read Documentation/SubmittingPatches for instructions on patch submission). To subscribe to the list, send an email with just “subscribe git” in the body to majordomo@vger.kernel.org. The mailing list archives are available at https://lore.kernel.org/git/, http://marc.info/?l=git and other archival sites.

Issues which are security relevant should be disclosed privately to the Git Security mailing list git-security@googlegroups.com.

The maintainer frequently sends the “What's cooking” reports that list the current status of various development topics to the mailing list. The discussion following them give a good reference for project status, development direction and remaining tasks.

The name “git” was given by Linus Torvalds when he wrote the very first version. He described the tool as “the stupid content tracker” and the name as (depending on your mood):

  • random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of “get” may or may not be relevant.
  • stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.
  • “global information tracker”: you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
  • “goddamn idiotic truckload of sh*t”: when it breaks