zextract.c (read_zip_archive): Read file_offset before writing zipd and consequently...
authorJeff Sturm <jeff.sturm@commerceone.com>
Mon, 29 Jan 2001 08:43:46 +0000 (08:43 +0000)
committerAlexandre Petit-Bianco <apbianco@gcc.gnu.org>
Mon, 29 Jan 2001 08:43:46 +0000 (00:43 -0800)
2000-01-24  Jeff Sturm  <jeff.sturm@commerceone.com>

* zextract.c (read_zip_archive): Read file_offset before writing
zipd and consequently clobbering the header contents.

(http://gcc.gnu.org/ml/gcc-patches/2001-01/msg02129.html)

From-SVN: r39328

gcc/java/ChangeLog
gcc/java/zextract.c

index 5a60bf92f1b9b0e5ac44f4018647735edee685ea..387e5169b454359ca507d31b77f7c903ef2654aa 100644 (file)
@@ -1,3 +1,8 @@
+2000-01-24  Jeff Sturm  <jeff.sturm@commerceone.com>
+
+       * zextract.c (read_zip_archive): Read file_offset before writing
+       zipd and consequently clobbering the header contents.
+
 2001-01-27  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * Make-lang.in: Remove all dependencies on defaults.h.
index 2226eeac61965cc5c22318c99b227d6d30fb12ee..3985cd9200142ded9c74dcd3dc627f240ca8d883 100644 (file)
@@ -323,6 +323,7 @@ read_zip_archive (zipf)
       long uncompressed_size = makelong (&dir_ptr[4+C_UNCOMPRESSED_SIZE]);
       long filename_length = makeword (&dir_ptr[4+C_FILENAME_LENGTH]);
       long extra_field_length = makeword (&dir_ptr[4+C_EXTRA_FIELD_LENGTH]);
+      long file_offset = makelong (&dir_ptr[4+C_RELATIVE_OFFSET_LOCAL_HEADER]);
       int unpadded_direntry_length;
       if ((dir_ptr-zipf->central_directory)+filename_length+CREC_SIZE+4>zipf->dir_size)
        return -1;
@@ -337,8 +338,7 @@ read_zip_archive (zipf)
 #else
 #define DIR_ALIGN sizeof(long)
 #endif
-      zipd->filestart = find_zip_file_start (zipf->fd, 
-                                            makelong (&dir_ptr[4+C_RELATIVE_OFFSET_LOCAL_HEADER]));
+      zipd->filestart = find_zip_file_start (zipf->fd, file_offset);
       zipd->filename_offset = CREC_SIZE+4 - dir_last_pad;
       unpadded_direntry_length 
          = zipd->filename_offset + zipd->filename_length + extra_field_length;