Skip to content

Account for all array objects when checking array size in SpEL #36998

Description

@sbrannen

When constructing a multidimensional array in a SpEL expression, ConstructorReference.createArray() enforces a size limit by checking the product of all dimension sizes. However, Java allocates a distinct array object at every nesting level, and the current check does not consider this count.

Ideally, the MAX_ARRAY_ELEMENTS threshold should apply to both the product of all dimension sizes and the total number of array objects allocated across all nesting levels.

Since SimpleEvaluationContext does not permit array creation within SpEL expressions, this enhancement effectively only applies to expressions evaluated via StandardEvaluationContext.

NOTE: This issue is assigned and therefore not suitable for community contributions.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions