SpEL, error parsing big InlineMap [SPR-17605] #22137
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
Davide Pallaoro opened SPR-17605 and commented
Hi,
In the project where I am working now, one of the components uses SpEL for parsing formulas stored in files.
Some of those formulas could be InlineMap, and I have encountered a problem when parsing pretty big maps (tens of thousands of elements).
Here you can find a short program that simulates the issue. If you, place the following files [^yes-works.spel] and [^not-works.spel] in /tmp/spel-test and run the following java class, using org.springframework:spring-expression 5.1.3-RELEASE
yesWork() will parse the map correctly and notWork() will raise the following exception
The files [^not-works.spel] and [^yes-works.spel] differ only for a space in position 655350.
It would be great that as long as the 2 maps contain the same items, both of them would be parsed correctly.
Looking into the code of spring I’ve noticed that the method
compress startPos and endPos into one single integer(32 bits), the problem here is that 655350 is bigger than (16bit) and therefore the result is not the expected one.
Moreover, I have noticed that in case of a InlineMap, it looks like that the value of pos is never read.
Let me know if everything is clear or you need some further details.
I’m pretty new into the Spring world, and I hope that I followed all the correct process in order to submit this issue, if not, please let me know.
Many thanks and kind regards.
Affects: 4.3.21, 5.0.11, 5.1.3
Attachments:
Issue Links:
Referenced from: commits b2756f5, c02446c, 15f255a
Backported to: 5.0.12, 4.3.22
The text was updated successfully, but these errors were encountered: