diff options
| author | 2010-10-22 08:59:24 -0700 | |
|---|---|---|
| committer | 2010-10-22 08:59:24 -0700 | |
| commit | 7ba8c44ef7ba22d83a670e50314d69d0ddce1b9c (patch) | |
| tree | c3dc318d20be052ad30122473325bee4e26b90e8 /libs/utils/ZipFileRO.cpp | |
| parent | d4d3f36f4c25b41f4253eadd5e67035fe220cad3 (diff) | |
| parent | 8ad30b5b7e380428701a44458393cbc2381f205b (diff) | |
am 8ad30b5b: Merge "Initialized check in ZipFileRO::findEntryByName" into gingerbread
Merge commit '8ad30b5b7e380428701a44458393cbc2381f205b' into gingerbread-plus-aosp
* commit '8ad30b5b7e380428701a44458393cbc2381f205b':
  Initialized check in ZipFileRO::findEntryByName
Diffstat (limited to 'libs/utils/ZipFileRO.cpp')
| -rw-r--r-- | libs/utils/ZipFileRO.cpp | 10 | 
1 files changed, 9 insertions, 1 deletions
diff --git a/libs/utils/ZipFileRO.cpp b/libs/utils/ZipFileRO.cpp index 5ff1f8f2c928..42611964b9f5 100644 --- a/libs/utils/ZipFileRO.cpp +++ b/libs/utils/ZipFileRO.cpp @@ -412,10 +412,18 @@ void ZipFileRO::addToHash(const char* str, int strLen, unsigned int hash)  /*   * Find a matching entry.   * - * Returns 0 if not found. + * Returns NULL if not found.   */  ZipEntryRO ZipFileRO::findEntryByName(const char* fileName) const  { +    /* +     * If the ZipFileRO instance is not initialized, the entry number will +     * end up being garbage since mHashTableSize is -1. +     */ +    if (mHashTableSize <= 0) { +        return NULL; +    } +      int nameLen = strlen(fileName);      unsigned int hash = computeHash(fileName, nameLen);      int ent = hash & (mHashTableSize-1);  |