tracker issue : CF-4175842

select a category, or use search below
(searches all categories and all time range)
Title:

InputBaseN returns incorrect data type in CF2016

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NotABug

Reporter/Name(from Bugbase): Erik Aulbach / Erik Aulbach (Erik Aulbach)

Created: 07/26/2016

Components: Language, Functions

Versions: 2016

Failure Type: Incorrect w/Workaround

Found In Build/Fixed In Build: CF2016_Update1 /

Priority/Frequency: Major / All users will encounter

Locale/System: English / Windows 10 64 bit

Vote Count: 0

Problem Description: The InputBaseN function now appears to return a 'Long' data type instead of an integer

Steps to Reproduce:<CFSET h = ArrayNew(1)>
<CFSET h[1] = InputBaseN("0x67452301",16)>
<CFSET h[2] = InputBaseN("0xefcdab89",16)>
<CFSET h[3] = InputBaseN("0x98badcfe",16)>
<CFSET h[4] = InputBaseN("0x10325476",16)>

<cfdump var="#h#">

Actual Result:
1	1732584193
2	4023233417
3	2562383102
4	271733878 

Expected Result:
1	1732584193
2	-271733879
3	-1732584194
4	271733878

Any Workarounds: For any functions that require an integer, I had to use #javacast("long",x).intValue()# to get the orig integer before I could use the function - otherwise it produced the error 'Cannot convert the value XXXXXXX to an integer because it cannot fit inside an integer'

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4175842

External Customer Info:
External Company:  
External Customer Name: Erik Aulbach
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

The Expected Result comes from a server still running CF10
Comment by External U.
2116 | July 26, 2016 02:02:13 PM GMT
Erik, InputBaseN function used to give incorrect result when the given input is out of integer range. There was a bug logged for this issue which we have addressed in ColdFusion 2016. For reference: https://bugbase.adobe.com/index.cfm?event=bug&id=CF-3712098
Comment by Nimit S.
2117 | July 27, 2016 03:15:44 AM GMT
Thank You Nimit, Ok - so if I understand this correctly, what is being returned in CF10 (and under - we've been using this code since CF8 w/o issues) is incorrect and the correct result is what we're getting with CF2016. Which means we need to check the value before using it in any of the BitWise functions since they only take a 32-bit signed integer - right?.
Comment by External U.
2118 | July 27, 2016 08:54:19 AM GMT
Yes, you are right. you only need to convert it when the given input is out of integer range.
Comment by Nimit S.
2119 | August 01, 2016 03:37:16 AM GMT