summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2025-03-04 17:13:58 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2025-03-04 17:13:58 -0800
commitf3a6a2ae2576b92b06cd95351f1be7d0af4d32d3 (patch)
treeb2e83357eaf6b9cdb9559977901997d7c8b668ed
parentb10a07bd4f646786615857daf16ebfc75dada4d8 (diff)
parent41c0c10f7b9e269480f3d406c2a2ed8975fbacce (diff)
Merge "[res] Add named padding to ResTable_config" into main
-rw-r--r--libs/androidfw/include/androidfw/ResourceTypes.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/libs/androidfw/include/androidfw/ResourceTypes.h b/libs/androidfw/include/androidfw/ResourceTypes.h
index 30594dcfa939..0d45149267cf 100644
--- a/libs/androidfw/include/androidfw/ResourceTypes.h
+++ b/libs/androidfw/include/androidfw/ResourceTypes.h
@@ -1265,6 +1265,9 @@ struct ResTable_config
// Varies in length from 3 to 8 chars. Zero-filled value.
char localeNumberingSystem[8];
+ // Mark all padding explicitly so it's clear how much we can expand it.
+ char endPadding[3];
+
void copyFromDeviceNoSwap(const ResTable_config& o) {
const auto o_size = dtohl(o.size);
if (o_size >= sizeof(ResTable_config)) [[likely]] {
@@ -1422,6 +1425,13 @@ struct ResTable_config
void swapHtoD_slow();
};
+// Fix the struct size for backward compatibility
+static_assert(sizeof(ResTable_config) == 64);
+
+// Make sure there's no unaccounted padding in the structure.
+static_assert(offsetof(ResTable_config, endPadding) +
+ sizeof(ResTable_config::endPadding) == sizeof(ResTable_config));
+
/**
* A specification of the resources defined by a particular type.
*