Commits


fix a size_t multiplication overflow in diff_meyrs.c Found on an OpenBSD armv7 machine running Got regression tests: test_status_shows_no_mods_after_complete_merge Segmentation fault (core dumped) The problematic multiplication is kd_len * kd_len in diff_algo_myers() with kd_len set to 65537. (gdb) p (int)(65537 * 65537) $64 = 131073 (gdb) p (int)(65537 + 65537) $65 = 131074 (gdb) p (unsigned int)(size_t)(-1) $68 = 4294967295 (gdb) p (4294967295 / kd_len) $71 = 65535 Detect such overflow and run the fallback diff algorithm instead.


set a minimum myers effort limit to avoid an early short-cut on small files discussed with Neels


add a missing include for uint8_t and switch from <inttypes.h> to <stdint.h> ok millert stsp


remove a bunch of overly verbose debug


cache kd_buf in struct diff_state to avoid repeated allocation + free


fix myers_divide max-effort cut, wrong x for backwards coordinate


debug output fixes - fix compilation error with DEBUG 1, after moving patience state out of diff_atom, and after renaming diff_data.d to diff_data.root. - add some missing newlines. - also debug "HIT" on a max-effort cut, like when finding a mid snake, which eases finding all the places where boxes get cut.


diff_myers: fix some uninitialized warnings


myers_divide: fix "inifite" looping over same box


debug: diff_myers.c: #if DEBUG, not if (DEBUG)


debug: fix "state size:" printing buf size


drop dangerous debug statement


move headers from include/diff/ to include/; makes things easier for consumers


repair DEBUG build


move some definitions from the public diff_main.h to an internal header file


use buffered stdio if falling back on file i/o; this is much faster


rename 'debug.h' to 'diff_debug.h'


myers_divide: stop traversing snakes after reasonable max effort


myers: error handling from diff_atoms_same()


add diff_atom_cmp() and error handling to diff_atom_same()


avoid include statements in header files; make each .c pull in what's needed


replace enum diff_rc errors with plain errno values


KNF: use max 80 columns


KNF: function declaration return types on separate line


fix myers divide: properly trigger division on single midpoints