[res] Make sure we properly validate the XML attr size

The old code used to only validate the total size as a product
of a single element size and the number of elements, but that
didn't actually guarantee that there will be that many elements,
as there's a hard limit on a single element size. Setting the
size < min size would pass the product check, but make the
accessing code read beyond the end of memory as it uses min
sizes instead of the specified size

Bug: 470115162
Flag: EXEMPT BUGFIX
Test: atest libandroidfw_tests
(cherry picked from commit 4d869cd4de74f1dccf30e729bd9caabc3b397e7a)
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:10ae6120c62d2eb4cb4ae3f3fc0484d6f594a141
Merged-In: Iaaaca9bb4c196e7acde0895d64da919c52448a44
Change-Id: Iaaaca9bb4c196e7acde0895d64da919c52448a44
2 files changed