| From 81474f24895f522fe42471601567efe90d2fb024 Mon Sep 17 00:00:00 2001 |
| From: Ben Chan <benchan@chromium.org> |
| Date: Wed, 19 Feb 2014 20:22:34 -0800 |
| Subject: [PATCH] handle extra bytes at the beginning of a zip file |
| |
| --- |
| modules/uzip.c | 17 +++++++++-------- |
| 1 file changed, 9 insertions(+), 8 deletions(-) |
| |
| diff --git a/modules/uzip.c b/modules/uzip.c |
| index 73ef0e5..f5f27f1 100644 |
| --- a/modules/uzip.c |
| +++ b/modules/uzip.c |
| @@ -286,7 +286,7 @@ static void zipnode_delete(struct zipnode *nod) |
| |
| static void fill_zipentry(struct archive *arch, const char *path, |
| struct entry *ent, struct cdirentry *cent, |
| - struct ecrec *ecrec) |
| + struct ecrec *ecrec, avoff_t extra_bytes) |
| { |
| struct archnode *nod; |
| struct zipnode *info; |
| @@ -315,12 +315,13 @@ static void fill_zipentry(struct archive *arch, const char *path, |
| if(cent->start_disk != 0 || ecrec->cdir_disk != 0) |
| info->headeroff = -1; |
| else |
| - info->headeroff = cent->file_off; |
| + info->headeroff = cent->file_off + extra_bytes; |
| |
| } |
| |
| static void insert_zipentry(struct archive *arch, char *path, |
| - struct cdirentry *cent, struct ecrec *ecrec) |
| + struct cdirentry *cent, struct ecrec *ecrec, |
| + avoff_t extra_bytes) |
| { |
| struct entry *ent; |
| int entflags = 0; |
| @@ -348,7 +349,7 @@ static void insert_zipentry(struct archive *arch, char *path, |
| if(ent == NULL) |
| return; |
| |
| - fill_zipentry(arch, path, ent, cent, ecrec); |
| + fill_zipentry(arch, path, ent, cent, ecrec, extra_bytes); |
| av_unref_obj(ent); |
| } |
| |
| @@ -457,7 +458,7 @@ static int parse_extra_header(vfile *vf, avoff_t pos, |
| } |
| |
| static avoff_t read_entry(vfile *vf, struct archive *arch, avoff_t pos, |
| - struct ecrec *ecrec) |
| + struct ecrec *ecrec, avoff_t extra_bytes) |
| { |
| int res; |
| char buf[CDIRENT_SIZE]; |
| @@ -508,7 +509,7 @@ static avoff_t read_entry(vfile *vf, struct archive *arch, avoff_t pos, |
| return -EIO; |
| } |
| |
| - insert_zipentry(arch, filename, &ent, ecrec); |
| + insert_zipentry(arch, filename, &ent, ecrec, extra_bytes); |
| av_free(filename); |
| |
| return pos + CDIRENT_SIZE + ent.fname_len + ent.extra_len + |
| @@ -645,7 +646,7 @@ static int read_zip64file(vfile *vf, struct archive *arch, struct ecrec *ecrec, |
| av_log(AVLOG_ERROR, "UZIP: Broken archive"); |
| return -EIO; |
| } |
| - cdir_pos = read_entry(vf, arch, cdir_pos, ecrec); |
| + cdir_pos = read_entry(vf, arch, cdir_pos, ecrec, extra_bytes); |
| if(cdir_pos < 0) |
| return cdir_pos; |
| } |
| @@ -698,7 +699,7 @@ static int read_zipfile(vfile *vf, struct archive *arch) |
| return -EIO; |
| } |
| |
| - cdir_pos = read_entry(vf, arch, cdir_pos, &ecrec); |
| + cdir_pos = read_entry(vf, arch, cdir_pos, &ecrec, extra_bytes); |
| if(cdir_pos < 0) |
| return cdir_pos; |
| } |
| -- |
| 2.18.0.597.ga71716f1ad-goog |
| |