You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2009/10/08 14:16:43 UTC
svn commit: r823140 -
/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java
Author: tellison
Date: Thu Oct 8 12:16:43 2009
New Revision: 823140
URL: http://svn.apache.org/viewvc?rev=823140&view=rev
Log:
Avoid potential long arithmetic overflow.
Modified:
harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java
Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java?rev=823140&r1=823139&r2=823140&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java (original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/ZipFile.java Thu Oct 8 12:16:43 2009
@@ -393,7 +393,7 @@
public int read(byte[] b, int off, int len) throws IOException {
synchronized (mSharedRaf) {
mSharedRaf.seek(mOffset);
- if (mOffset + len > mLength) {
+ if (len > mLength - mOffset) {
len = (int) (mLength - mOffset);
}
int count = mSharedRaf.read(b, off, len);