Commit Graph

7783 Commits

Author SHA1 Message Date
Carlos Martín Nieto
a7fa970f8b Merge pull request #2895 from ethomson/alloc_overflow
allocations: test for overflow of requested size
2015-02-15 05:13:50 +01:00
Carlos Martín Nieto
b23c206e59 Merge pull request #2903 from ethomson/rebase
Fixups for rebase
2015-02-15 05:03:51 +01:00
Edward Thomson
ffbd51edc8 rebase: CHECKOUT_SAFE instead of FORCE
Switch to a standard branch-switching pattern of a `SAFE` checkout,
then updating `HEAD`.
2015-02-13 11:38:00 -05:00
Edward Thomson
49b8293c75 rebase: allow NULL branch to indicate HEAD
Don't require the branch to rebase, if given `NULL`, simply look up
`HEAD`.
2015-02-13 11:20:32 -05:00
Edward Thomson
92e87dd749 rebase: provide NULL exec on non-EXEC operations
Users may want to try to pay attention to the `exec` field on all
rebase operations.
2015-02-13 10:44:19 -05:00
Carlos Martín Nieto
57f45e7f4d Merge pull request #2901 from ethomson/win32_mode_bits
win32: limit the mode to `_wopen`/`_waccess`
2015-02-13 15:58:39 +01:00
Edward Thomson
0f07d54b44 pack-objects: unlock the cache on integer overflow 2015-02-13 09:35:20 -05:00
Edward Thomson
d97d9559e3 buf test: cleanup memory leak 2015-02-13 09:28:12 -05:00
Edward Thomson
16942c6fda integer overflow: use compiler intrinsics if supported
gcc and clang support __builtin_add_overflow, use it whenever
possible, falling back to our naive routines.
2015-02-13 09:28:09 -05:00
Edward Thomson
8aab36a301 filebuf: use an int for return check 2015-02-13 09:28:05 -05:00
Edward Thomson
f1453c59b2 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.
2015-02-13 09:27:33 -05:00
Edward Thomson
527ed59ad8 win32: limit the mode to _wopen/_waccess
Win32 generally ignores Unix-like mode bits that don't make any
sense on the platform (eg `0644` makes no sense to Windows).  But
WINE complains loudly when presented with POSIXy bits.  Remove them.

(Thanks @phkelley)
2015-02-13 09:18:49 -05:00
Carlos Martín Nieto
0b2ee7c07c Merge pull request #2883 from urkud/reget-reader-pointer
Reinit `reader` pointer after reading included config file
2015-02-13 08:56:01 +01:00
Carlos Martín Nieto
3ca91107fc Merge pull request #2897 from leoyanggit/fix_fileop_warning
Fix build warning on Android
2015-02-13 08:30:21 +01:00
Edward Thomson
650e45f691 Update khash.h to pull request 42
https://github.com/attractivechaos/klib/pull/42/files introduces
`kreallocarray`.  Hook that up as our `git__reallocarray`.
2015-02-12 22:54:48 -05:00
Edward Thomson
1ad48c8a08 khash: update to klib f28c067 2015-02-12 22:54:47 -05:00
Edward Thomson
190b76a698 Introduce git__add_sizet_overflow and friends
Add some helper functions to check for overflow in a type-specific
manner.
2015-02-12 22:54:47 -05:00
Edward Thomson
8d534b4758 p_read: ensure requested len is ssize_t
Ensure that the given length to `p_read` is of ssize_t and ensure
that callers test the return as if it were an `ssize_t`.
2015-02-12 22:54:47 -05:00
Edward Thomson
ec3b4d35f6 Use size_t to hold size of arrays
Use `size_t` to hold the size of arrays to ease overflow checking,
lest we check for overflow of a `size_t` then promptly truncate
by packing the length into a smaller type.
2015-02-12 22:54:47 -05:00
Edward Thomson
2884cc42de overflow checking: don't make callers set oom
Have the ALLOC_OVERFLOW testing macros also simply set_oom in the
case where a computation would overflow, so that callers don't
need to.
2015-02-12 22:54:47 -05:00
Edward Thomson
4aa664ae39 git_buf_grow_by: increase buf asize incrementally
Introduce `git_buf_grow_by` to incrementally increase the size of a
`git_buf`, performing an overflow calculation on the growth.
2015-02-12 22:54:47 -05:00
Edward Thomson
3603cb0978 git__*allocarray: safer realloc and malloc
Introduce git__reallocarray that checks the product of the number
of elements and element size for overflow before allocation.  Also
introduce git__mallocarray that behaves like calloc, but without the
`c`.  (It does not zero memory, for those truly worried about every
cycle.)
2015-02-12 22:54:47 -05:00
Edward Thomson
15d54fdd34 odb__hashlink: check st.st_size before casting 2015-02-12 22:54:46 -05:00
Edward Thomson
392702ee2c allocations: test for overflow of requested size
Introduce some helper macros to test integer overflow from arithmetic
and set error message appropriately.
2015-02-12 22:54:46 -05:00
Leo Yang
3556a82a2a Fix build warning on Android
Always do a time_t cast on st_mtime. st_mtime on Android is not
the type of time_t but has the same meaning which is the number
of seconds past epoch.
2015-02-12 16:38:55 -05:00
Edward Thomson
de84d9b439 Merge pull request #2899 from libgit2/jamill/rebase_opt_ver_check
Check rebase options version on public entry points
2015-02-12 16:34:01 -05:00
Yury G. Kudryashov
1713653883 Reinit reader pointer after reading included config file
Fixes #2869. If included file includes more files, it may reallocate
cfg_file->readers, hence invalidate not only `r` pointer, but `result`
pointer as well.
2015-02-13 00:15:16 +03:00
Yury G. Kudryashov
3ea78f241f Add test for include.path inside included config
It fails at least on my computer, though it may depend on some unpredictable
factors (say, will realloc() extend the memory segment in place, or it will
allocate new memory).
2015-02-13 00:15:16 +03:00
Jameson Miller
02eb1495a5 Check rebase options version on public entry points 2015-02-12 15:32:52 -05:00
Carlos Martín Nieto
d24a5312d8 Merge pull request #2866 from ethomson/checkout_perf2
Checkout performance
2015-02-12 02:34:58 +01:00
Carlos Martín Nieto
8e29ae7310 Merge pull request #2862 from jeffhostetler/jeffhostetler/bug/branch_create_after_namespace
Remove stale reflog namespace directory before branch creation
2015-02-12 00:43:01 +01:00
Carlos Martín Nieto
e07c1e1a15 Merge pull request #2880 from ethomson/mkdir_root
Ensure we can make a repo at the root of the filesystem
2015-02-12 00:40:12 +01:00
Carlos Martín Nieto
5a2a5771fe Merge pull request #2845 from rakuco/libssh2-detection-fix
Add libssh2's library and include directories.
2015-02-12 00:34:48 +01:00
Carlos Martín Nieto
6dbbced2b1 Merge pull request #2889 from jeffhostetler/jeffhostetler/merge_performance
Large merge perf test.
2015-02-12 00:27:17 +01:00
Carlos Martín Nieto
5820edc11e Merge pull request #2894 from ethomson/copyrights
Update some third-party copyrights
2015-02-11 23:59:16 +01:00
Carlos Martín Nieto
dc63c0496b Merge pull request #2893 from phatblat/ben/pr/doc-comments
Fix doc comment formatting
2015-02-11 23:44:05 +01:00
John Haley
a36486ef26 Fixed error when including git2/include/sys/stream.h 2015-02-11 23:30:34 +01:00
Edward Thomson
0b55ed9542 clar: use actual license and copyright 2015-02-10 21:34:20 -05:00
Edward Thomson
ec510666a1 Credit utf8proc for utf8 iterator 2015-02-10 21:34:08 -05:00
Ben Chatelain
c03e8c224c Use correct Doxygen trailing comment syntax 2015-02-10 12:44:05 -07:00
Ben Chatelain
ec7e1c93ce Fix doc comment formatting 2015-02-10 08:31:48 -07:00
nulltoken
b703049c61 Merge pull request #2890 from arthurschreiber/patch-5
Speed up AppVeyor builds.
2015-02-06 23:24:50 +01:00
Arthur Schreiber
554063a5fe Speed up AppVeyor builds.
AppVeyor build machines come with Python 2.7 and CMake 2.8 pre-installed and in the PATH.
2015-02-06 23:12:58 +01:00
Jeff Hostetler
d97ba7f674 Large merge perf test. 2015-02-06 15:45:59 -05:00
Edward Thomson
3db1b15e16 Merge pull request #2884 from libgit2/cmn/template-path
repository: parse init.templatedir as a path
2015-02-05 20:01:56 -05:00
Carlos Martín Nieto
cc36f424d4 repository: parse init.templatedir as a path
This is a path so we must use the path getter so we get the tilde
expansion done.
2015-02-06 01:09:26 +01:00
Edward Thomson
bebd201737 Merge pull request #2881 from ethomson/clar
Update clar to d17c7f6
2015-02-05 14:10:25 -05:00
Edward Thomson
83276dccbe Update clar to d17c7f6 2015-02-05 13:24:38 -05:00
Edward Thomson
9cb5b0f73c mkdir: respect the root path
Don't try to strip trailing paths from the root directory on
Windows (trying to create `C:` will fail).
2015-02-05 12:27:19 -05:00
Edward Thomson
3c68bfcd08 stat: don't remove trailing '/' from root on win32
`p_stat` calls `git_win32_path_from_utf8`, which canonicalizes the
path.  Do not further try to modify the path, else we trim the
trailing slash from a root directory and try to access `C:` instead
of `C:/`.
2015-02-05 12:27:16 -05:00