Change in 7.1.2.173+ causes spreadsheet-cfml to fail

The following change to how bytes are cast to java introduced in Lucee 7.1.2.173 is causing spreadsheet-cfml to fail.

https://luceeserver.atlassian.net/browse/LDEV-5193

Repro

rgbBytes = [ 255, 0, 0 ] //RED
bytes = JavaCast( "byte[]", rgbBytes )
dump( bytes )

Result in Lucee 7.1.2.172 and below

Native byte array

Result in Lucee 7.1.2.173 and above

lucee.runtime.exp.ExpressionException: The value [255] is outside the range of the Java type [byte] (-128 to 127)
 at lucee.runtime.op.Caster.rangeException(Caster.java:911)
 at lucee.runtime.op.Caster.checkRange(Caster.java:905)
 at lucee.runtime.op.Caster.toByteValue(Caster.java:1459)
 at lucee.runtime.op.Caster.toByte(Caster.java:1548)
 at lucee.runtime.op.Caster.castTo(Caster.java:5187)
 at lucee.runtime.functions.string.JavaCast.to(JavaCast.java:100)
 at lucee.runtime.functions.string.JavaCast._toArray(JavaCast.java:91)
 at lucee.runtime.functions.string.JavaCast.toArray(JavaCast.java:78)
 at lucee.runtime.functions.string.JavaCast.call(JavaCast.java:58)
 at lucee.runtime.functions.string.JavaCast.call(JavaCast.java:49)

@Julian_Halliwell ,
Created a bug ticket for this issue: LDEV-6915.

The issue is reproducible in Lucee 7.1.3.0-SNAPSHOT. I’ll investigate the root cause, work on a fix, and provide further updates here.

2 Likes

Thanks Julian, this looks like a regression from LDEV-5193, tracked as LDEV-6915. The old behaviour of wrapping values 128–255 into a signed byte should keep working, and we’ll make sure the fix lands in 7.1.x.

The library shouldn’t be relying on that conversion so I’ve added a fix at my end.

1 Like