diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2024-08-09 11:53:01 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2024-08-09 11:53:01 +0200 |
commit | 9b73ec4d12d65f3366e7cc5c3533d84d8c442a67 (patch) | |
tree | 1fd98c6a0bc1d60ec12423f8c35cda0c4ff11e47 /org.eclipse.jgit/src/org/eclipse/jgit | |
parent | d3a5637d924825b59673c098ce7c51fb2e5ad722 (diff) | |
download | jgit-9b73ec4d12d65f3366e7cc5c3533d84d8c442a67.tar.gz jgit-9b73ec4d12d65f3366e7cc5c3533d84d8c442a67.zip |
Fix "Comparison of narrow type with wide type in loop condition"stable-5.13
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
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java index 715cbb48fb..cfceed00e8 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/PackParser.java @@ -531,7 +531,7 @@ public abstract class PackParser { receiving.beginTask(JGitText.get().receivingObjects, (int) expectedObjectCount); try { - for (int done = 0; done < expectedObjectCount; done++) { + for (long done = 0; done < expectedObjectCount; done++) { indexOneObject(); receiving.update(1); if (receiving.isCancelled()) |