Skip to content

Commit

Permalink
[GR-51680] Fix possible infinite recursion in AbstractJSObjectArray.s…
Browse files Browse the repository at this point in the history
…etElementImpl.
  • Loading branch information
woess committed Jan 30, 2024
1 parent 159292d commit 84cdb60
Showing 1 changed file with 10 additions and 5 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
Expand Down Expand Up @@ -78,10 +78,15 @@ public final ScriptArray setElementImpl(JSDynamicObject object, long index, Obje
}

private ScriptArray rewrite(JSDynamicObject object, long index, Object value) {
if (isSupportedContiguous(object, index)) {
return toContiguous(object, index, value);
} else if (isSupportedHoles(object, index)) {
return toHoles(object, index, value);
if (JSDynamicObject.isJSDynamicObject(value)) {
assert !isSupported(object, index);
if (isSupportedContiguous(object, index)) {
return toContiguous(object, index, value);
} else if (isSupportedHoles(object, index)) {
return toHoles(object, index, value);
} else {
return toSparse(object, index, value);
}
} else {
return toObject(object, index, value);
}
Expand Down

0 comments on commit 84cdb60

Please sign in to comment.