"Arithmetic operation resulted in an overflow." in "CRC32.Crc32Result.get"

Feb 4, 2009 at 11:53 AM
Someone get this already?

An "Arithmetic operation resulted in an overflow." is happening when compacting the attached files (please extract the files before)
Its not happening when using the old "1.5.0.11" version when the CRC32 class was using UInt32 instead of the current Int32 in version 1.6.3.18
Coordinator
Feb 4, 2009 at 4:50 PM
Let me have a look at the workitem.
Feb 4, 2009 at 6:25 PM
Edited Feb 4, 2009 at 6:28 PM
i have been using this project a lot of time without this error....but in this file something wrong
looks like UINT32 can support the cr32 but it cant be an INT32 in this time... the value is huge...
i can change the types to UINT32 but like you said "Fxcop dont like UINT32"...
Feb 5, 2009 at 12:24 PM
Hello Cheeso,
 Did you have successfully reproduced the error ?
Thks
Coordinator
Feb 5, 2009 at 6:14 PM
No, I haven't had a chance to look at it yet.  I will let you know.

Coordinator
Feb 9, 2009 at 11:26 PM
Hey Alex, I just tried this and was not able to reproduce the error.
I downloaded the .rar file, extracted it, and then used a program to zip up the resulting txt files.
No problems.
Then I unzipped them.  
No problems.

What do I need to do to repro the problem?
Do I need to explicitly retrieve the CRC32? 
Doing just a zip and unzip, the DotNetZip library will internally compute and verify the CRC32.   If the CRC check fails, DotNetZip will throw.   It did not throw. 
???

I updated the workitem to this effect, too.


Feb 10, 2009 at 11:15 AM
Hey Cheeso.
All you need is in the images that i have attached in WorkItem.
Only you need to get the error is compacting that files.
Anything you need I am available, only ask

Ps. I'm using a "checked" environment in my project

Thks
Feb 10, 2009 at 11:53 AM
Hey Cheeso....
The problemn is: the Method "Crc32.GetCrc32AndCopy" uses "unchecked" in returns of "(Int32)(~_RunningCrc32Result)" but the property "Crc32.Crc32Result" doesnt use "unchecked"
Hope this help.

Thks
Coordinator
Feb 10, 2009 at 6:17 PM

Hey Alex, thanks for getting back to me with more information.
I have not been able to reproduce the problem.
you have said:  "All you need to do is compact the files."

By "compacting the files" do you mean....  creating a new zip archive, adding the files, and then saving the archive? 

I've done that.  I did that with the .txt files and I have now done it with the .jpg files.
Compacting the files is not causing the problem for me.

Can you give me some application code that reproduces the error?
Eg...

  using (var zip = new ZipFile())
  {
       ????
  }

Can you give me a stacktrace?

Also, can you try this with the latest v1.7 of the library and see if it occurs for you there? 

Thanks, I hope we can figure this out.

Feb 10, 2009 at 6:21 PM
Hey Cheeso.
To reproduce the error you must be in a "Checked" environment, like in my prints screens

Coordinator
Feb 10, 2009 at 6:52 PM
oh!  I had misunderstood.
I thought the JPG's were files for me to zip.

ok,
can you modify the code to look like this please:

 

        public Int32 Crc32Result
        {
            get
            {
                // return one's complement of the running result
                return unchecked((Int32)(~_RunningCrc32Result));
            }
        }

Can you test with that?

Feb 10, 2009 at 6:55 PM
No prob.
Its works now...
Coordinator
Feb 10, 2009 at 6:59 PM
GREAT
thanks for helping me through this.