зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1675465 - Add DIAGNOSTIC_ASSERT in nsJARInputStream::Read r=jstutte
We want to make sure we don't accidentally read more than the size of the file. Differential Revision: https://phabricator.services.mozilla.com/D96006
This commit is contained in:
Родитель
2190dfaf69
Коммит
0c6e62ade6
|
@ -220,6 +220,8 @@ nsJARInputStream::Read(char* aBuffer, uint32_t aCount, uint32_t* aBytesRead) {
|
|||
|
||||
case MODE_COPY:
|
||||
if (mFd) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(mOutSize >= mZs.total_out,
|
||||
"Did we read more than expected?");
|
||||
uint32_t count = std::min(aCount, mOutSize - uint32_t(mZs.total_out));
|
||||
if (count) {
|
||||
memcpy(aBuffer, mZs.next_in + mZs.total_out, count);
|
||||
|
|
Загрузка…
Ссылка в новой задаче