Bug 1167888 - better string length check in nsZipArchive::BuildFileList, r=smaug
This commit is contained in:
@@ -644,8 +644,13 @@ MOZ_WIN_MEM_TRY_BEGIN
|
|||||||
if (!centralOffset)
|
if (!centralOffset)
|
||||||
return NS_ERROR_FILE_CORRUPTED;
|
return NS_ERROR_FILE_CORRUPTED;
|
||||||
|
|
||||||
//-- Read the central directory headers
|
|
||||||
buf = startp + centralOffset;
|
buf = startp + centralOffset;
|
||||||
|
|
||||||
|
// avoid overflow of startp + centralOffset.
|
||||||
|
if (buf < startp)
|
||||||
|
return NS_ERROR_FILE_CORRUPTED;
|
||||||
|
|
||||||
|
//-- Read the central directory headers
|
||||||
uint32_t sig = 0;
|
uint32_t sig = 0;
|
||||||
while (buf + int32_t(sizeof(uint32_t)) <= endp &&
|
while (buf + int32_t(sizeof(uint32_t)) <= endp &&
|
||||||
(sig = xtolong(buf)) == CENTRALSIG) {
|
(sig = xtolong(buf)) == CENTRALSIG) {
|
||||||
|
|||||||
Reference in New Issue
Block a user