Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SandHook
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
SandHook
Commits
c5b4c704
Commit
c5b4c704
authored
Jan 23, 2019
by
swift_gan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix offset
parent
3cace0f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
13 deletions
+14
-13
cast_art_method.h
app/src/main/cpp/casts/cast_art_method.h
+13
-12
cast.h
app/src/main/cpp/includes/cast.h
+1
-1
No files found.
app/src/main/cpp/casts/cast_art_method.h
View file @
c5b4c704
...
...
@@ -58,10 +58,10 @@ namespace SandHook {
class
CastEntryPointQuickCompiled
:
public
IMember
<
art
::
mirror
::
ArtMethod
,
void
*>
{
protected
:
Size
calOffset
(
JNIEnv
*
jniEnv
,
art
::
mirror
::
ArtMethod
*
p
)
override
{
if
(
SDK_INT
>=
ANDROID_
L2
)
{
if
(
SDK_INT
>=
ANDROID_
M
)
{
return
getParentSize
()
-
BYTE_POINT
;
}
else
{
return
getParentSize
()
-
8
*
2
-
4
*
4
;
return
getParentSize
()
-
4
-
2
*
BYTE_POINT
;
}
}
};
...
...
@@ -86,10 +86,17 @@ namespace SandHook {
accessFlag
=
524313
;
}
int
offset
=
findOffset
(
p
,
getParentSize
(),
2
,
accessFlag
);
if
(
offset
<
0
)
return
getParentSize
()
+
1
;
else
if
(
offset
<
0
)
{
if
(
SDK_INT
==
ANDROID_L2
)
{
return
20
;
}
else
if
(
SDK_INT
==
ANDROID_L
)
{
return
56
;
}
else
{
return
getParentSize
()
+
1
;
}
}
else
{
return
static_cast
<
size_t
>
(
offset
);
}
}
};
...
...
@@ -132,13 +139,7 @@ namespace SandHook {
Size
artMethod1
=
(
Size
)
env
->
GetStaticMethodID
(
sizeTestClass
,
"method1"
,
"()V"
);
Size
artMethod2
=
(
Size
)
env
->
GetStaticMethodID
(
sizeTestClass
,
"method2"
,
"()V"
);
if
(
sdk
==
ANDROID_L2
)
{
size
=
64
;
}
else
if
(
sdk
==
ANDROID_L
)
{
size
=
72
;
}
else
{
size
=
artMethod2
-
artMethod1
;
}
size
=
artMethod2
-
artMethod1
;
art
::
mirror
::
ArtMethod
*
m1
=
reinterpret_cast
<
art
::
mirror
::
ArtMethod
*>
(
artMethod1
);
art
::
mirror
::
ArtMethod
*
m2
=
reinterpret_cast
<
art
::
mirror
::
ArtMethod
*>
(
artMethod2
);
...
...
app/src/main/cpp/includes/cast.h
View file @
c5b4c704
...
...
@@ -11,8 +11,8 @@
#include <jni.h>
#include "arch.h"
#include "utils.h"
#include "../casts/art/art.h"
#define ANDROID_K 19
#define ANDROID_L 21
#define ANDROID_L2 22
#define ANDROID_M 23
...
...
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