Skip to content

Commit

Permalink
relates to github bcgit#1479 - check for invalid extension sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
dghgit committed Aug 26, 2023
1 parent b0ca436 commit c9446a6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/src/main/java/org/bouncycastle/asn1/x509/Extensions.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ else if (obj != null)
private Extensions(
ASN1Sequence seq)
{
if (seq.size() == 0)
{
throw new IllegalArgumentException("empty extension sequence found");
}

Enumeration e = seq.getObjects();

while (e.hasMoreElements())
Expand Down Expand Up @@ -110,6 +115,11 @@ public Extensions(
public Extensions(
Extension[] extensions)
{
if (extensions == null || extensions.length == 0)
{
throw new IllegalArgumentException("extension array cannot be null or empty");
}

for (int i = 0; i != extensions.length; i++)
{
Extension ext = extensions[i];
Expand Down

0 comments on commit c9446a6

Please sign in to comment.