peterreilly 2005/01/10 09:12:10
Modified: . CONTRIBUTORS WHATSNEW
src/main/org/apache/tools/tar TarBuffer.java
Log:
fix for infinite loop on incorrect tar files
PR: 29877
Obtained from: Ray Waldin
Revision Changes Path
1.41 +1 -0 ant/CONTRIBUTORS
Index: CONTRIBUTORS
===================================================================
RCS file: /home/cvs/ant/CONTRIBUTORS,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- CONTRIBUTORS 26 Nov 2004 09:52:05 -0000 1.40
+++ CONTRIBUTORS 10 Jan 2005 17:12:10 -0000 1.41
@@ -172,6 +172,7 @@
Rami Ojares
Randy Watler
Raphael Pierquin
+Ray Waldin
Richard Evans
Rick Beton
Robert Anderson
1.707 +3 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.706
retrieving revision 1.707
diff -u -r1.706 -r1.707
--- WHATSNEW 7 Jan 2005 21:58:23 -0000 1.706
+++ WHATSNEW 10 Jan 2005 17:12:10 -0000 1.707
@@ -227,6 +227,9 @@
* <setproxy> failed to set user/password on some JDKs.
Bugzilla report 32667
+* untar would go into infinite loop for some invalid tar files.
+ Bugzill report 29877
+
Changes from Ant 1.6.1 to Ant 1.6.2
===================================
1.13 +10 -1 ant/src/main/org/apache/tools/tar/TarBuffer.java
Index: TarBuffer.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/tar/TarBuffer.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TarBuffer.java 9 Mar 2004 16:48:55 -0000 1.12
+++ TarBuffer.java 10 Jan 2005 17:12:10 -0000 1.13
@@ -1,5 +1,5 @@
/*
- * Copyright 2000,2002,2004 The Apache Software Foundation
+ * Copyright 2000,2002,2004-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
+import java.util.Arrays;
/**
* The TarBuffer class implements the tar archive concept
@@ -231,6 +232,14 @@
// Thanks to '[EMAIL PROTECTED]' for this fix.
//
if (numBytes == -1) {
+ // However, just leaving the unread portion of the buffer
dirty does
+ // cause problems in some cases. This problem is described
in
+ // http://issues.apache.org/bugzilla/show_bug.cgi?id=29877
+ //
+ // The solution is to fill the unused portion of the buffer
with zeros.
+
+ Arrays.fill(blockBuffer, offset, offset + bytesNeeded,
(byte) 0);
+
break;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]