You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@corinthia.apache.org by pm...@apache.org on 2015/08/01 19:30:27 UTC
incubator-corinthia git commit: Fix invalid memory access of
zipDirEntry
Repository: incubator-corinthia
Updated Branches:
refs/heads/newZipExperiment bc2f161ad -> 685b6a196
Fix invalid memory access of zipDirEntry
Pointer arithmetic was being used to calculate the address of a
DFextZipDirEntry. However, the type of the pointer in question was
already DFextZipDirEntry, so it was only necessary to add the index,
without multiplying by the size of the struct.
Instead, just access it by the array element.
Project: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/commit/685b6a19
Tree: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/tree/685b6a19
Diff: http://git-wip-us.apache.org/repos/asf/incubator-corinthia/diff/685b6a19
Branch: refs/heads/newZipExperiment
Commit: 685b6a19675c5420b06f8c4b8e492d6640641e72
Parents: bc2f161
Author: Peter Kelly <pe...@uxproductivity.com>
Authored: Sun Aug 2 00:28:56 2015 +0700
Committer: Peter Kelly <pe...@uxproductivity.com>
Committed: Sun Aug 2 00:28:56 2015 +0700
----------------------------------------------------------------------
DocFormats/platform/src/Wrapper_zip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-corinthia/blob/685b6a19/DocFormats/platform/src/Wrapper_zip.c
----------------------------------------------------------------------
diff --git a/DocFormats/platform/src/Wrapper_zip.c b/DocFormats/platform/src/Wrapper_zip.c
index 5fcadf3..dac3523 100644
--- a/DocFormats/platform/src/Wrapper_zip.c
+++ b/DocFormats/platform/src/Wrapper_zip.c
@@ -143,7 +143,7 @@ static int readDirectory(FILE *zipFile, DFextZipHandleP zipHandle)
// Each file starts with a local header
{
ZipFileHeader *recFile = (ZipFileHeader *)workBuf;
- DFextZipDirEntry *zipDirEntry = zipHandle->zipFileEntries + (i * sizeof(zipDirEntry));
+ DFextZipDirEntry *zipDirEntry = &zipHandle->zipFileEntries[i];
// find local file info, read it and verify signature
if (fseek(zipFile, recDir->relativeOffsetOflocalHeader, SEEK_SET)