Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Upgrade semver4j to 4.1.1 to prevent NullPointerException #5190

Merged
merged 2 commits into from Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions core/src/test/java/org/owasp/dependencycheck/utils/SemverTest.java
Expand Up @@ -13,6 +13,7 @@
*/
package org.owasp.dependencycheck.utils;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;
Expand All @@ -32,4 +33,15 @@ public void testSemver() {
Semver semver = new Semver("3.1.4");
assertTrue(semver.satisfies("^3.0.0-0"));
}
/**
* Test of semver4j. See https://github.com/jeremylong/DependencyCheck/issues/5158
*/
@Test
public void testSemverComplex() {
Semver semver = new Semver("18.11.5");
assertFalse(semver.satisfies("^14.14.20 || ^16.0.0"));

semver = new Semver("14.15.0");
assertTrue(semver.satisfies("^14.14.20 || ^16.0.0"));
}
}
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -1069,7 +1069,7 @@ Copyright (c) 2012 - Jeremy Long
<dependency>
<groupId>org.semver4j</groupId>
<artifactId>semver4j</artifactId>
<version>4.1.0</version>
<version>4.1.1</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
Expand Down