This project is read-only.

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

Feb 4, 2009 at 12:53 PM
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 "" version when the CRC32 class was using UInt32 instead of the current Int32 in version
Feb 4, 2009 at 5:50 PM
Let me have a look at the workitem.
Feb 4, 2009 at 7:25 PM
Edited Feb 4, 2009 at 7: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 1:24 PM
Hello Cheeso,
 Did you have successfully reproduced the error ?
Feb 5, 2009 at 7:14 PM
No, I haven't had a chance to look at it yet.  I will let you know.

Feb 10, 2009 at 12:26 AM
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 12:15 PM
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

Feb 10, 2009 at 12:53 PM
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.

Feb 10, 2009 at 7: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?

  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 7:21 PM
Hey Cheeso.
To reproduce the error you must be in a "Checked" environment, like in my prints screens

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

can you modify the code to look like this please:


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

Can you test with that?

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