wmgnn1314 / mezzofanti

Automatically exported from code.google.com/p/mezzofanti
0 stars 0 forks source link

Integer Overflow in AssetsManager.java - prevents use of program with big sdcards #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Mount an sdcard with more than 1.2 gb free (thats what I had)
2. start application
3. size available is negative (integer overflow)

What is the expected output? What do you see instead?

Message box saying not enough free space available, shows negative value.

What version of the product are you using? On what operating system?
Android 1.5 - HTC hero

Please provide any additional information below.

Both StatFs.getAvailableBlocks() and StatFs.getBlockSize() return ints, and 
since integer promotion doesn't happen until this value is returned, the 
result is an overflow.

Here's the fix:
line 129, AssetsManager.java

129c129
<             return stat.getAvailableBlocks() * stat.getBlockSize();

---
>             return ((long) stat.getAvailableBlocks()) * ((long) 
stat.getBlockSize());

Original issue reported on code.google.com by dan.wer...@gmail.com on 27 Mar 2010 at 5:32

GoogleCodeExporter commented 9 years ago
that happens too on samsung galaxy spica.. android 1.5 with 8G sdcard

Original comment by adji...@gmail.com on 18 May 2010 at 10:46

GoogleCodeExporter commented 9 years ago
Same problem on Nexus 1

Original comment by fal...@gmail.com on 22 Aug 2010 at 9:22

GoogleCodeExporter commented 9 years ago
Is anyone using this application? Should I fork and maintain it myself?

Original comment by dan.wer...@gmail.com on 23 Aug 2010 at 3:36

GoogleCodeExporter commented 9 years ago
Is there a solution available?

Original comment by alexande...@gmail.com on 1 Sep 2010 at 5:27

GoogleCodeExporter commented 9 years ago
re: Alex

That was the hope in submitting the issue to the project site: my fix is right 
there in the issue; cast to long on both sides as I return the value. 

If you have an android dev environment going, just edit line 129 of 
AssetsManager.java and change it to:

return ((long) stat.getAvailableBlocks()) * ((long) stat.getBlockSize()); 

Then recompile, and deploy to your device.

Original comment by dan.wer...@gmail.com on 1 Sep 2010 at 8:32

GoogleCodeExporter commented 9 years ago
same problem on htc desire, the fix here works fine

Original comment by christoph.luder on 11 Sep 2010 at 6:09

GoogleCodeExporter commented 9 years ago
re: dan.werner

thanks for the fix. its working on nexus one now. however there are few more 
glitches thats bothering me. so before i get deep into this solution, i was 
wondering the same as you are about whether ITWizard folks are maintaining this 
project anymore? or shall we request commits privileges? 

I wrote an email to Vlad (at ITWizard) regarding the same. Let us see if 
something comes back.

Original comment by srikanth...@gmail.com on 31 Oct 2010 at 3:38

GoogleCodeExporter commented 9 years ago
Is there anyway to use the patched code without having to recompile the whole 
application? (I don't have the dev suite installed).  Does anyone have a 
patched version I could download?

Original comment by jimktra...@gmail.com on 8 Apr 2011 at 6:47

GoogleCodeExporter commented 9 years ago
Thank you dan.werner for the fix, it works now.
Unfortunately I still can't get it to translate anything.

Original comment by Bopsi...@gmail.com on 28 Sep 2011 at 8:42