corinthia-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmke...@apache.org
Subject incubator-corinthia git commit: Fix invalid memory access of zipDirEntry
Date Sat, 01 Aug 2015 17:30:27 GMT
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 <peter@uxproductivity.com>
Authored: Sun Aug 2 00:28:56 2015 +0700
Committer: Peter Kelly <peter@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)


Mime
View raw message