]> source.dussan.org Git - jgit.git/commit
Fix "Comparison of narrow type with wide type in loop condition" 67/1198667/1 stable-5.13
authorMatthias Sohn <matthias.sohn@sap.com>
Fri, 9 Aug 2024 09:53:01 +0000 (11:53 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Fri, 9 Aug 2024 09:53:01 +0000 (11:53 +0200)
commit9b73ec4d12d65f3366e7cc5c3533d84d8c442a67
tree1fd98c6a0bc1d60ec12423f8c35cda0c4ff11e47
parentd3a5637d924825b59673c098ce7c51fb2e5ad722
Fix "Comparison of narrow type with wide type in loop condition"

This issue was detected by a GitHub CodeQL security scan run on JGit
source code.

Description of the error raised by the security scan:
"In a loop condition, comparison of a value of a narrow type with a
value of a wide type may always evaluate to true if the wider value is
sufficiently large (or small). This is because the narrower value may
overflow. This can lead to an infinite loop."

Fix this by using type `long` for the local variable `done`.

Change-Id: Ibd4f71299e3f2e40d4331227bd143569a4264d8c
org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java