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

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
This commit is contained in:
Jeff Sturm 2001-01-29 08:43:46 +00:00 committed by Alexandre Petit-Bianco
parent f2d1f0ba55
commit 7be00c496f
2 changed files with 7 additions and 2 deletions

View 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.

View 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;