summaryrefslogtreecommitdiffstats
path: root/minui/resources.cpp
diff options
context:
space:
mode:
authorxunchang <xunchang@google.com>2019-04-16 21:07:42 +0200
committerxunchang <xunchang@google.com>2019-04-22 23:39:51 +0200
commit9d05c8a35776444f6e967f8a4ac5863a31e54cf6 (patch)
tree3bea493d37159d462e27802aae147a425c9810ed /minui/resources.cpp
parentMerge "Allow entering rescue mode via recovery UI." (diff)
downloadandroid_bootable_recovery-9d05c8a35776444f6e967f8a4ac5863a31e54cf6.tar
android_bootable_recovery-9d05c8a35776444f6e967f8a4ac5863a31e54cf6.tar.gz
android_bootable_recovery-9d05c8a35776444f6e967f8a4ac5863a31e54cf6.tar.bz2
android_bootable_recovery-9d05c8a35776444f6e967f8a4ac5863a31e54cf6.tar.lz
android_bootable_recovery-9d05c8a35776444f6e967f8a4ac5863a31e54cf6.tar.xz
android_bootable_recovery-9d05c8a35776444f6e967f8a4ac5863a31e54cf6.tar.zst
android_bootable_recovery-9d05c8a35776444f6e967f8a4ac5863a31e54cf6.zip
Diffstat (limited to '')
-rw-r--r--minui/resources.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/minui/resources.cpp b/minui/resources.cpp
index 069a49529..53c932bff 100644
--- a/minui/resources.cpp
+++ b/minui/resources.cpp
@@ -414,12 +414,18 @@ int res_create_localized_alpha_surface(const char* name,
__unused int len = row[4];
char* loc = reinterpret_cast<char*>(&row[5]);
- if (y + 1 + h >= height || matches_locale(loc, locale)) {
+ // We need to include one additional line for the metadata of the localized image.
+ if (y + 1 + h > height) {
+ printf("Read exceeds the image boundary, y %u, h %d, height %u\n", y, h, height);
+ return -8;
+ }
+
+ if (matches_locale(loc, locale)) {
printf(" %20s: %s (%d x %d @ %d)\n", name, loc, w, h, y);
auto surface = GRSurface::Create(w, h, w, 1);
if (!surface) {
- return -8;
+ return -9;
}
for (int i = 0; i < h; ++i, ++y) {
@@ -428,7 +434,7 @@ int res_create_localized_alpha_surface(const char* name,
}
*pSurface = surface.release();
- break;
+ return 0;
}
for (int i = 0; i < h; ++i, ++y) {
@@ -436,7 +442,7 @@ int res_create_localized_alpha_surface(const char* name,
}
}
- return 0;
+ return -10;
}
void res_free_surface(GRSurface* surface) {