summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Light <allight@google.com>2016-03-24 14:57:00 -0700
committerAlex Light <allight@google.com>2016-03-29 11:59:09 -0700
commit796fe5399a161f870d94dd7fadf3c6100b1d1640 (patch)
tree82100d77a91007fa7267f45f97ce556c1ccc5d58
parentc265adc1587393083cf5f6aac4bca0bc6918353f (diff)
downloaddalvik-796fe5399a161f870d94dd7fadf3c6100b1d1640.tar.gz
Add support for dex version 37 in libdex.
Bug: 27538761 Bug: 27809626 (cherry picked from commit 5c391cc69978326b08f303e37951b6924038520c) Change-Id: I79b2bdfc8194dc210bc1299b0544f82b2af735b0
-rw-r--r--libdex/DexFile.h5
-rw-r--r--libdex/DexSwapVerify.cpp3
2 files changed, 7 insertions, 1 deletions
diff --git a/libdex/DexFile.h b/libdex/DexFile.h
index e8ab31924..593d4142a 100644
--- a/libdex/DexFile.h
+++ b/libdex/DexFile.h
@@ -87,6 +87,11 @@ typedef int64_t s8;
/* DEX file magic number */
#define DEX_MAGIC "dex\n"
+/* The version for android N, encoded in 4 bytes of ASCII. This differentiates dex files that may
+ * use default methods.
+ */
+#define DEX_MAGIC_VERS_37 "037\0"
+
/* current version, encoded in 4 bytes of ASCII */
#define DEX_MAGIC_VERS "036\0"
diff --git a/libdex/DexSwapVerify.cpp b/libdex/DexSwapVerify.cpp
index 46ce14171..2b653b80b 100644
--- a/libdex/DexSwapVerify.cpp
+++ b/libdex/DexSwapVerify.cpp
@@ -2792,7 +2792,8 @@ bool dexHasValidMagic(const DexHeader* pHeader)
}
if ((memcmp(version, DEX_MAGIC_VERS, 4) != 0) &&
- (memcmp(version, DEX_MAGIC_VERS_API_13, 4) != 0)) {
+ (memcmp(version, DEX_MAGIC_VERS_API_13, 4) != 0) &&
+ (memcmp(version, DEX_MAGIC_VERS_37, 4) != 0)) {
/*
* Magic was correct, but this is an unsupported older or
* newer format variant.