Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
dalvik
Commits
0e216ea3
Commit
0e216ea3
authored
11 years ago
by
Jeff Hao
Committed by
Android (Google) Code Review
11 years ago
Browse files
Options
Download
Plain Diff
Merge "Ignore invalid access flags." into klp-dev
parents
dfec26e7
4b44ea2e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
11 deletions
+17
-11
libdex/DexSwapVerify.cpp
libdex/DexSwapVerify.cpp
+14
-7
vm/oo/Class.cpp
vm/oo/Class.cpp
+3
-0
vm/oo/Object.h
vm/oo/Object.h
+0
-4
No files found.
libdex/DexSwapVerify.cpp
View file @
0e216ea3
...
...
@@ -912,8 +912,9 @@ static void* swapClassDefItem(const CheckState* state, void* ptr) {
SWAP_OFFSET4
(
item
->
classDataOff
);
if
((
item
->
accessFlags
&
~
ACC_CLASS_MASK
)
!=
0
)
{
ALOGE
(
"Bogus class access flags %x"
,
item
->
accessFlags
);
return
NULL
;
// The VM specification says that unknown flags should be ignored.
ALOGV
(
"Bogus class access flags %x"
,
item
->
accessFlags
);
item
->
accessFlags
&=
ACC_CLASS_MASK
;
}
return
item
+
1
;
...
...
@@ -1457,8 +1458,9 @@ static bool verifyFields(const CheckState* state, u4 size,
}
if
((
accessFlags
&
~
ACC_FIELD_MASK
)
!=
0
)
{
ALOGE
(
"Bogus field access flags %x @ %d"
,
accessFlags
,
i
);
return
false
;
// The VM specification says that unknown flags should be ignored.
ALOGV
(
"Bogus field access flags %x @ %d"
,
accessFlags
,
i
);
field
->
accessFlags
&=
ACC_FIELD_MASK
;
}
}
...
...
@@ -1487,12 +1489,17 @@ static bool verifyMethods(const CheckState* state, u4 size,
return
false
;
}
if
(((
accessFlags
&
~
ACC_METHOD_MASK
)
!=
0
)
||
(
isSynchronized
&&
!
allowSynchronized
))
{
ALOGE
(
"Bogus method access flags %x @ %d"
,
accessFlags
,
i
);
if
(
isSynchronized
&&
!
allowSynchronized
)
{
ALOGE
(
"Bogus method access flags (synchronization) %x @ %d"
,
accessFlags
,
i
);
return
false
;
}
if
((
accessFlags
&
~
ACC_METHOD_MASK
)
!=
0
)
{
// The VM specification says that unknown flags should be ignored.
ALOGV
(
"Bogus method access flags %x @ %d"
,
accessFlags
,
i
);
method
->
accessFlags
&=
ACC_METHOD_MASK
;
}
if
(
expectCode
)
{
if
(
method
->
codeOff
==
0
)
{
ALOGE
(
"Unexpected zero code_off for access_flags %x"
,
...
...
This diff is collapsed.
Click to expand it.
vm/oo/Class.cpp
View file @
0e216ea3
...
...
@@ -1740,6 +1740,9 @@ static ClassObject* loadClassFromDex0(DvmDex* pDvmDex,
* Make sure the aren't any "bonus" flags set, since we use them for
* runtime state.
*/
/* bits we can reasonably expect to see set in a DEX access flags field */
const
uint32_t
EXPECTED_FILE_FLAGS
=
(
ACC_CLASS_MASK
|
CLASS_ISPREVERIFIED
|
CLASS_ISOPTIMIZED
);
if
((
pClassDef
->
accessFlags
&
~
EXPECTED_FILE_FLAGS
)
!=
0
)
{
ALOGW
(
"Invalid file flags in class %s: %04x"
,
descriptor
,
pClassDef
->
accessFlags
);
...
...
This diff is collapsed.
Click to expand it.
vm/oo/Object.h
View file @
0e216ea3
...
...
@@ -82,10 +82,6 @@ enum ClassFlags {
CLASS_ISPREVERIFIED
=
(
1
<<
16
),
// class has been pre-verified
};
/* bits we can reasonably expect to see set in a DEX access flags field */
#define EXPECTED_FILE_FLAGS \
(ACC_CLASS_MASK | CLASS_ISPREVERIFIED | CLASS_ISOPTIMIZED)
/*
* Get/set class flags.
*/
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment