Merge "Fix security issue in DynamicRefTable::load." into qt-qpr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
084cc32ce8
@@ -6902,9 +6902,8 @@ std::unique_ptr<DynamicRefTable> DynamicRefTable::clone() const {
|
|||||||
status_t DynamicRefTable::load(const ResTable_lib_header* const header)
|
status_t DynamicRefTable::load(const ResTable_lib_header* const header)
|
||||||
{
|
{
|
||||||
const uint32_t entryCount = dtohl(header->count);
|
const uint32_t entryCount = dtohl(header->count);
|
||||||
const uint32_t sizeOfEntries = sizeof(ResTable_lib_entry) * entryCount;
|
|
||||||
const uint32_t expectedSize = dtohl(header->header.size) - dtohl(header->header.headerSize);
|
const uint32_t expectedSize = dtohl(header->header.size) - dtohl(header->header.headerSize);
|
||||||
if (sizeOfEntries > expectedSize) {
|
if (entryCount > (expectedSize / sizeof(ResTable_lib_entry))) {
|
||||||
ALOGE("ResTable_lib_header size %u is too small to fit %u entries (x %u).",
|
ALOGE("ResTable_lib_header size %u is too small to fit %u entries (x %u).",
|
||||||
expectedSize, entryCount, (uint32_t)sizeof(ResTable_lib_entry));
|
expectedSize, entryCount, (uint32_t)sizeof(ResTable_lib_entry));
|
||||||
return UNKNOWN_ERROR;
|
return UNKNOWN_ERROR;
|
||||||
|
|||||||
Reference in New Issue
Block a user