Smallint validating incorrectly

Description

This is also a difference between ACF and Lucee, as I just moved this site over from ACF two days ago and this error started popping up:

Out of range value for column 'prid' at row 1

This is a smallint column. The value in this case was 60674, which is below the max for smallint unsigned (65535). But it also triggered with a value somewhere in the 30k mark the other day.

At first I thought I had buggered up my db import, but after testing this evening it's the addition of "sqltype="smallint"" inside <cfqueryparam> that is triggering this. I then ran a test and found that it's rejecting any value higher than the SIGNED max, which is 32767. So 32766 is ok, 32768 triggers an exception. Removing sqltype='smallint' lets it through.

Obviously in this case I'm already pushing the upper limits of smallint here anyway, so will make the swap to mediumint, but figure this is actually worthwhile mentioning here.

Environment

Lucee 5.3.6.61.
Ubuntu 18.04
mysql-connector-java-8.0.19 (Revision: a0ca826f5cdf51a98356fdfb1bf251eb042f80bf)

Activity

Show:
Pothys - MitrahSoft
October 9, 2020, 4:58 PM

I've checked this ticket and confirmed the issue happened on lucee latest version 5.3.8.76-SNAPSHOT also. cfsqltype=cf_sql_smallint works incorrectly with range of values. And added a test case too.

Pull Request: https://github.com/lucee/Lucee/pull/1061

Assignee

Michael Offner

Reporter

Sam Daams

Priority

Major

Labels

Fix versions

None
Configure