Saving of cfimage to Database stopped working in 5.2.4.37

Description

Error message happens when trying to save :
Can't cast String [Illegal character padding in sequence to be decoded: [0, =, =, =]] to a value of type [binary] Java

This problem is happening in code that has not been modified. The problem only occurs on version 5.2.4.37. When we use commandbox to specify any other previous lucee version, the code runs fine.

We are copying an image, watermarking and resizing it, then converting it to a png file, and saving it to a SQL Server database. The database column is a varbinary(max)

Code to create image (passGenerated is a cfimage variable):

local.passThumbnail=ImageNew(arguments.args.passGenerated);
// Add a "watermark"
local.width=ImageGetWidth(local.passThumbnail);
local.height=ImageGetHeight(local.passThumbnail);
ImageSetDrawingColor(local.passThumbnail,"C6C6C6");
ImageDrawLine(local.passThumbnail,0,0,local.width,local.height);
ImageDrawLine(local.passThumbnail,0,local.height,local.width,0);
ImageResize(local.passThumbnail,"20%","","highperformance");
local.ppArgs.passThumbnail = local.passThumbnail.getImageBytes('png');
Code that is saving it to the database:

local.qInsert = queryExecute(
" insert into pass_print_log
(requestID,passThumbnail,logid)
values
(:requestID,assThumbnail,:logID)",
{
requestID: {value: arguments.requestStruct.requestID, CFSQLType: 'CF_SQL_INTEGER'},
passThumbnail: {value: arguments.requestStruct.passThumbnail, CFSQLType: 'CF_SQL_BLOB'},
logID: {value: arguments.requestStruct.logID, CFSQLType: 'CF_SQL_BIGINT'}
},
{
datasource: instance.gmsbox.name,
result: "qResult"
}
);

Environment

Windows, SQL Server

Activity

Show:
Pothys - MitrahSoft
November 6, 2017, 3:26 PM

I've added testcase for this ticket & Confirmed that issue happened on 5.2.4.37 version. This issue occurs both SQLserver & MySQL.

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

Michael Offner
November 17, 2017, 1:33 PM
Fixed

Assignee

Michael Offner

Reporter

Cam Penner

Priority

Critical

Labels

None

Fix versions

Sprint

None

Affects versions