]> source.dussan.org Git - jgit.git/commit
Fix off-by-one error in RebaseTodoFile when reading a todo file 25/140925/2
authorThomas Wolf <thomas.wolf@paranor.ch>
Sun, 21 Apr 2019 19:23:30 +0000 (21:23 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Fri, 7 Jun 2019 14:19:31 +0000 (16:19 +0200)
commitd2600693bd5fb8bda20bae41467132668caa1e14
tree64ad6dbc3092e53288eea0e9fcb73f289e0a5ea0
parent00f840dcd1fc53b3face0d824af0eb9de9d19f08
Fix off-by-one error in RebaseTodoFile when reading a todo file

Commit messages of length 1 were not read. 'lineEnd' is the offset
of the last character in the line before the terminating LF or CR-LF,
and 'nextSpace' is actually the offset of the character _after_ the
next space. With a one-character commit message, nextSpace == lineEnd.

The code also assumes the commit message to be optional, but actually
failed in that case because it read beyond the line ending. Fix that,
too.

Add a test case for reading a todo file.

Bug: 546245
Change-Id: I368d63615930ea2398a6230e756442fd88870654
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RebaseTodoFileTest.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/lib/RebaseTodoFile.java