Hallo @All
With D2010 activated range checking reading NULL-values from UNICODE columns causes a runtime error.
My Test-Setup:
* Have an ORACLE-Table "XY" with VARCHAR-column containing NULL-values
* Add "ZEncoding.pas" (for debugging) to my project.
* Activate Range checking and overflow checking in the D2010 compiler
* Make a select from table "XY"
* Run into an error in function "ZRawToUnicode" in module "ZEncoding.pas" in line
l := MultiByteToWideChar(CP, 0, PAnsiChar(@s[1]), - 1, nil, 0); //Checkout the Result-Lengh
=> As the string "s" is null, referencing the index [1] causes the range check error.
Crosscheck:
* Update the column-value with a string "abc" (using SQLPlus)
* Make a select from table "XY"
* Unicode column value is read correctly without errors
Patch:
* Check the string length first
if (s='') then Exit;
l := MultiByteToWideChar(CP, 0, PAnsiChar(@s[1]), - 1, nil, 0); //Checkout the Result-Lengh
My assumption is that the bug also affects databases other than ORACLE (but not tested).
Best regards
Chris
ZEOS Version 7.1.4-Stable
ORACLE 11.2.0.1
Delphi 2010
Christoph Wiwie
http://www.wiwie.de
Certified Tester/ Certified Requirements Engineer
Runtime-Error during (ORACLE) Unicode data selection (with activated D2010 Compiler Range-Check/Overflow checking)
-
- Fresh Boarder
- Posts: 7
- Joined: 08.05.2014, 14:58