Page 1 of 1

Integer Overflow

Posted: Tue Jun 02, 2015 12:54 am
by Dmeade
Im using Xls Read Write version 5.20.49

if i create a new Excel sheet using microsoft Excel 2013
and add a Line Chart and save that file

create a new Delphi project and in the
project Options - compiling - Runtime Errors
if the Overflow checking and range checking are checked

and you try and read the xlsx file you get a
Integer overflow. exception

im not worried about the chart but we are unable to load the data from the excel file when this happens

Re: Integer Overflow

Posted: Tue Jun 02, 2015 12:48 pm
by larsa
Hello

Overflow checking and range checking shall be turned off. Integers and arrays are used in such a way the these checks can't be used.

Re: Integer Overflow

Posted: Tue Jun 16, 2015 2:05 am
by Dmeade
Version 5.20.50
still gets the integer overflow error

Re: Integer Overflow

Posted: Tue Jun 16, 2015 3:13 pm
by larsa
Hello

Overflow checking shall still be turned off.

Re: Integer Overflow

Posted: Wed Jul 15, 2015 11:41 pm
by Dmeade
Version 5.20.51
still gets the integer overflow error

Re: Integer Overflow

Posted: Tue Jul 28, 2015 2:21 am
by Dmeade
version 5.20.52
getting the integer overflow error

Re: Integer Overflow

Posted: Tue Jul 28, 2015 12:26 pm
by d3nton
You can solve it by temporarily turning of range checks and overflow checks in unit xpgPXML.pas function TXpgReadXML.QNameHashA: longword;

Code: Select all

{$IFOPT R+}
  {$DEFINE R_PLUS}
  {$RANGECHECKS OFF}
{$ENDIF}
{$IFOPT Q+}
 {$DEFINE Q_PLUS}
  {$OVERFLOWCHECKS OFF}
{$ENDIF}
function TXpgReadXML.QNameHashB: longword;
var
  ..
begin
  ..
end;
{$IFDEF R_PLUS}
  {$RANGECHECKS ON}
  {$UNDEF R_PLUS}
{$ENDIF}
{$IFDEF Q_PLUS}
  {$OVERFLOWCHECKS ON}
  {$UNDEF Q_PLUS}
{$ENDIF}
@Lars: Could you add this to XLSReadWrite, please?

Re: Integer Overflow

Posted: Tue Aug 04, 2015 12:55 am
by Dmeade
version 5.20.53
getting the integer overflow error - in the default build

after adding d3nton's suggested solution - i'm no longer getting the error

Re: Integer Overflow

Posted: Thu Sep 10, 2015 3:40 am
by Dmeade
Using Version 5.20.56 default build
gets Integer overflow with xlsx files that have image or chart

I have added an example project to Github

Git link
https://github.com/dangas56/XLSWR_IntegerOverflow.git

zip files are here
https://github.com/dangas56/XLSWR_Integ ... /tag/1.0.1

Adding d3nton's suggested solution resolved the issue

is there a reason why its not in the release version?

Re: Integer Overflow

Posted: Mon Sep 14, 2015 9:46 am
by larsa
Hello

As I wrote before, the code is written in such a way that overflow checking shall be turned off. The fix suggested by d3nton only solves one problem. The whole code must be checked before overflow checking can be on, and this will not happened. If you want to have overflow checking on, use the compiled dcu:s instead of compiling the source code.