dudaerich opened a new issue, #1886: URL: https://github.com/apache/pekko/issues/1886
Although the bug is present in https://github.com/lightbend/config/ I am reporting it here as the library is not maintained - see [this discussion](https://github.com/apache/pekko/discussions/400) as evidence. The problem is in the following code: ``` int hash = Math.abs(k.hashCode()); int i = hash % entries.length; Entry e = entries[i]; ``` The Javadoc for [Math.abs](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Math.html#abs(int)) says: "Note that if the argument is equal to the value of Integer.MIN_VALUE, the most negative representable int value, the result is that same value, which is negative.". So, if the k.hashCode() returns Integer.MIN_VALUE, the variable `i` is negative and the code tries to access element of array with negative index resulting into index out of bounds. In my case, the variable `k` refers to `com.typesafe.config.impl.MemoKey` which is not under my control, so I cannot influence the `hashCode` method. See attached stack trace. This error appears intermittently in our tests but we saw it also on production. ``` Caused by : Index -59 out of bounds for length 61 com.typesafe.config.impl.BadMap.get(BadMap.java:105) com.typesafe.config.impl.ResolveMemos.get(ResolveMemos.java:22) com.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:163) com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:146) com.typesafe.config.impl.ResolveSource.findInObject(ResolveSource.java:47) com.typesafe.config.impl.ResolveSource.lookupSubst(ResolveSource.java:97) com.typesafe.config.impl.ConfigReference.resolveSubstitutions(ConfigReference.java:74) com.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:183) com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:146) com.typesafe.config.impl.ConfigConcatenation.resolveSubstitutions(ConfigConcatenation.java:205) com.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:183) com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:146) com.typesafe.config.impl.SimpleConfigObject$ResolveModifier.modifyChildMayThrow(SimpleConfigObject.java:380) com.typesafe.config.impl.SimpleConfigObject.modifyMayThrow(SimpleConfigObject.java:313) com.typesafe.config.impl.SimpleConfigObject.resolveSubstitutions(SimpleConfigObject.java:399) com.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:183) com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:146) com.typesafe.config.impl.SimpleConfigObject$ResolveModifier.modifyChildMayThrow(SimpleConfigObject.java:380) com.typesafe.config.impl.SimpleConfigObject.modifyMayThrow(SimpleConfigObject.java:313) com.typesafe.config.impl.SimpleConfigObject.resolveSubstitutions(SimpleConfigObject.java:399) com.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:183) com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:146) com.typesafe.config.impl.SimpleConfigObject$ResolveModifier.modifyChildMayThrow(SimpleConfigObject.java:380) com.typesafe.config.impl.SimpleConfigObject.modifyMayThrow(SimpleConfigObject.java:313) com.typesafe.config.impl.SimpleConfigObject.resolveSubstitutions(SimpleConfigObject.java:399) com.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:183) com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:146) com.typesafe.config.impl.SimpleConfigObject$ResolveModifier.modifyChildMayThrow(SimpleConfigObject.java:380) com.typesafe.config.impl.SimpleConfigObject.modifyMayThrow(SimpleConfigObject.java:313) com.typesafe.config.impl.SimpleConfigObject.resolveSubstitutions(SimpleConfigObject.java:399) com.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:183) com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:146) com.typesafe.config.impl.SimpleConfigObject$ResolveModifier.modifyChildMayThrow(SimpleConfigObject.java:380) com.typesafe.config.impl.SimpleConfigObject.modifyMayThrow(SimpleConfigObject.java:313) com.typesafe.config.impl.SimpleConfigObject.resolveSubstitutions(SimpleConfigObject.java:399) com.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:183) com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:146) com.typesafe.config.impl.SimpleConfigObject$ResolveModifier.modifyChildMayThrow(SimpleConfigObject.java:380) com.typesafe.config.impl.SimpleConfigObject.modifyMayThrow(SimpleConfigObject.java:313) com.typesafe.config.impl.SimpleConfigObject.resolveSubstitutions(SimpleConfigObject.java:399) com.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:183) com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:146) com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:235) com.typesafe.config.impl.SimpleConfig.resolveWith(SimpleConfig.java:79) com.typesafe.config.impl.SimpleConfig.resolve(SimpleConfig.java:69) com.typesafe.config.impl.SimpleConfig.resolve(SimpleConfig.java:42) com.typesafe.config.ConfigFactory.load(ConfigFactory.java:219) com.typesafe.config.ConfigFactory.load(ConfigFactory.java:186) com.typesafe.config.ConfigFactory$1.call(ConfigFactory.java:264) com.typesafe.config.ConfigFactory$1.call(ConfigFactory.java:261) com.typesafe.config.impl.ConfigImpl$LoaderCache.getOrElseUpdate(ConfigImpl.java:66) com.typesafe.config.impl.ConfigImpl.computeCachedConfig(ConfigImpl.java:93) com.typesafe.config.ConfigFactory.load(ConfigFactory.java:261) org.apache.pekko.actor.ActorSystem$.$anonfun$apply$4(ActorSystem.scala:280) scala.Option.getOrElse(Option.scala:201) org.apache.pekko.actor.ActorSystem$.apply(ActorSystem.scala:280) org.apache.pekko.actor.ActorSystem$.apply(ActorSystem.scala:327) org.apache.pekko.actor.ActorSystem.apply(ActorSystem.scala:271) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org For additional commands, e-mail: notifications-h...@pekko.apache.org