From e24c2780b6d44c7e5d386e70a1fb3346149ccdc9 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Tue, 04 Aug 2026 07:15:33 +0000
Subject: [PATCH] Fix CodeQL note-severity alerts: array logging and uncaught NumberFormatException (#817)
---
opendj-server-legacy/src/main/java/org/opends/server/protocols/asn1/GSERParser.java | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/asn1/GSERParser.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/asn1/GSERParser.java
index a43494a..92ba2f9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/asn1/GSERParser.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/asn1/GSERParser.java
@@ -13,6 +13,7 @@
*
* Copyright 2013-2014 Manuel Gaupp
* Portions Copyright 2014-2016 ForgeRock AS.
+ * Portions Copyright 2026 3A Systems, LLC.
*/
package org.opends.server.protocols.asn1;
@@ -382,7 +383,16 @@
.substring(pos,length));
throw new GSERException(msg);
}
- return Integer.valueOf(next(GSER_INTEGER)).intValue();
+ final String integer = next(GSER_INTEGER);
+ try
+ {
+ return Integer.parseInt(integer);
+ }
+ catch (NumberFormatException e)
+ {
+ // The value matches the integer pattern but does not fit in an int.
+ throw new GSERException(ERR_GSER_NO_VALID_INTEGER.get(integer), e);
+ }
}
--
Gitblit v1.10.0