diff options
author | Dan Albert <danalbert@google.com> | 2015-04-07 18:43:15 -0700 |
---|---|---|
committer | Dan Albert <danalbert@google.com> | 2015-04-08 14:12:21 -0700 |
commit | 1b4f316651096f0ef9301b4ffde4816a08a54ab5 (patch) | |
tree | f141604343f4114337483ed0fb30fe36f4750310 /include | |
parent | 47c1cf4b35616059409a0674382c2318494e877b (diff) | |
download | frameworks_base-1b4f316651096f0ef9301b4ffde4816a08a54ab5.zip frameworks_base-1b4f316651096f0ef9301b4ffde4816a08a54ab5.tar.gz frameworks_base-1b4f316651096f0ef9301b4ffde4816a08a54ab5.tar.bz2 |
Fix UB in ResourceTable::stringToInt.
Was here because UBsan found integer overflow in the parsing for hex
numbers, since hex numbers here are actually unsigned but assigned to
a signed integer.
Also fixes a number of missing error conditions.
Change-Id: Iaea576daedfc6c75521cde02de3fe9dd0198a3b7
Diffstat (limited to 'include')
-rw-r--r-- | include/androidfw/ResourceTypes.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/androidfw/ResourceTypes.h b/include/androidfw/ResourceTypes.h index 8673219..ff2c6d1 100644 --- a/include/androidfw/ResourceTypes.h +++ b/include/androidfw/ResourceTypes.h @@ -372,7 +372,8 @@ struct Res_value }; // The data for this item, as interpreted according to dataType. - uint32_t data; + typedef uint32_t data_type; + data_type data; void copyFrom_dtoh(const Res_value& src); }; @@ -1502,6 +1503,8 @@ private: KeyedVector<String16, uint8_t> mEntries; }; +bool U16StringToInt(const char16_t* s, size_t len, Res_value* outValue); + /** * Convenience class for accessing data in a ResTable resource. */ |